payload: {"action":"created","comment":{"url":"https://api.github.com/repos/ThrowTheSwitch/CMock/pulls/comments/344704521","pull_request_review_id":314887930,"id":344704521,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM0NDcwNDUyMQ==","diff_hunk":"@@ -41,14 +44,60 @@ def parse(name, source)\n       end\n     end\n \n+    if @treat_inlines == :include","path":"lib/cmock_header_parser.rb","position":30,"original_position":30,"commit_id":"fe829f2d8a0404b247a6091d6f2a4943bac95f11","original_commit_id":"fe829f2d8a0404b247a6091d6f2a4943bac95f11","user":{"login":"mvandervoord","id":16511,"node_id":"MDQ6VXNlcjE2NTEx","avatar_url":"https://avatars0.githubusercontent.com/u/16511?v=4","gravatar_id":"","url":"https://api.github.com/users/mvandervoord","html_url":"https://github.com/mvandervoord","followers_url":"https://api.github.com/users/mvandervoord/followers","following_url":"https://api.github.com/users/mvandervoord/following{/other_user}","gists_url":"https://api.github.com/users/mvandervoord/gists{/gist_id}","starred_url":"https://api.github.com/users/mvandervoord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvandervoord/subscriptions","organizations_url":"https://api.github.com/users/mvandervoord/orgs","repos_url":"https://api.github.com/users/mvandervoord/repos","events_url":"https://api.github.com/users/mvandervoord/events{/privacy}","received_events_url":"https://api.github.com/users/mvandervoord/received_events","type":"User","site_admin":false},"body":"a slight improvement, since you're always using `:normalized_source` below:\r\n\r\n```\r\n@normalized_source = if (@treat_inlines == :include)\r\n  transform_inline_functions(source)\r\nelse\r\n  ''\r\nend\r\n```\r\n\r\nI hope I'm not digging into too many minor details. You mentioned you're not strong at Ruby, so I thought you might like a little best-practices along the way. :)\r\n\r\nWith the way I've put it above, `@normalized_source` will always be defined to be something, just in case it's ever directly addressed (which it is just a little further down). ","created_at":"2019-11-11T13:13:31Z","updated_at":"2019-11-11T13:13:31Z","html_url":"https://github.com/ThrowTheSwitch/CMock/pull/261#discussion_r344704521","pull_request_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/pulls/261","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ThrowTheSwitch/CMock/pulls/comments/344704521"},"html":{"href":"https://github.com/ThrowTheSwitch/CMock/pull/261#discussion_r344704521"},"pull_request":{"href":"https://api.github.com/repos/ThrowTheSwitch/CMock/pulls/261"}}},"pull_request":{"url":"https://api.github.com/repos/ThrowTheSwitch/CMock/pulls/261","id":339184781,"node_id":"MDExOlB1bGxSZXF1ZXN0MzM5MTg0Nzgx","html_url":"https://github.com/ThrowTheSwitch/CMock/pull/261","diff_url":"https://github.com/ThrowTheSwitch/CMock/pull/261.diff","patch_url":"https://github.com/ThrowTheSwitch/CMock/pull/261.patch","issue_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/issues/261","number":261,"state":"open","locked":false,"title":"Inline function mocking","user":{"login":"laurensmiers","id":8750023,"node_id":"MDQ6VXNlcjg3NTAwMjM=","avatar_url":"https://avatars3.githubusercontent.com/u/8750023?v=4","gravatar_id":"","url":"https://api.github.com/users/laurensmiers","html_url":"https://github.com/laurensmiers","followers_url":"https://api.github.com/users/laurensmiers/followers","following_url":"https://api.github.com/users/laurensmiers/following{/other_user}","gists_url":"https://api.github.com/users/laurensmiers/gists{/gist_id}","starred_url":"https://api.github.com/users/laurensmiers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laurensmiers/subscriptions","organizations_url":"https://api.github.com/users/laurensmiers/orgs","repos_url":"https://api.github.com/users/laurensmiers/repos","events_url":"https://api.github.com/users/laurensmiers/events{/privacy}","received_events_url":"https://api.github.com/users/laurensmiers/received_events","type":"User","site_admin":false},"body":"Hi all,\r\n\r\nThis is an attempt to fix #150. I've heard/read in several issues (unrelated to this) that there are plans to rewrite the parser behind CMock which would fix this I guess but this is an attempt/PoC with the current implementation of CMock.\r\n\r\nThe problem with inline functions is that we have to rewrite the original header to get rid of them and 'disguise' them as normal functions, which CMock knows how to handle and parse.\r\nThe code under test would have to include the new header instead of the original header to be able to use the mocked versions of our inline functions (which are now normal functions).\r\n\r\nThe idea behind this implementation is basically to transform inline functions to 'normal' functions and generate a header that the tests + mocks can use (so without inline functions):\r\n- CMock will take the original header, remove all inline functions and replace them with 'normal' function declarations, f.e.:\r\n`static inline int my_func(int a) {\r\n        return a++;\r\n}`\r\nwould become:\r\n`int my_func(int a);`\r\n\r\nThe latter is a function that CMock can handle and mock perfectly. So we will replace the former with the latter in our generated header (I called it normalized but feel free to rename it).\r\nThis generated header has the same name as the original header, only difference is the transformation of the inline functions.\r\nIt is important to note that nothing else is changed, the complete original header is copied to the generated header minus the inline functions.\r\n- The generated header (without the inlines) is placed in the same directory as the mock_original_header_name.c/h. This will guarantee that we include our generated header in the mocks and not the original header (which we don't want because this one has the inline functions).\r\nWe would have to make sure the generated header build path is set as include path **before** the original header path during compilation of the tests, but normally, with Ceedling, this is already done (correct me if I'm wrong).\r\n\r\nHope this makes it a bit more clear what this pull request is doing...\r\n\r\nI tested it with a project of my own and it seems to be working fine (with Ceedling), pretty sure there are cases that I haven't thought of yet so this is probably something that needs to be tested further. Not sure how this would go, if you need more support, let me know and/or if there are more unit tests, etc required.\r\nIf this is not the way you want to go with the handling of inline functions in CMock, you can close this pull request, I won't hold it against you :).\r\n\r\nIf there are issues, questions, let me know,\r\nKR,\r\n\r\nLaurens\r\n\r\nDISCLAIMER: I'm not a ruby programmer so if you think this is something you want merged but want it more ruby-ish, let me know and I'll change it.\r\n","created_at":"2019-11-10T19:58:30Z","updated_at":"2019-11-11T13:13:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"95fdbc6343ebe4a1f62c88093b71e137a7bdc66f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/pulls/261/commits","review_comments_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/pulls/261/comments","review_comment_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/issues/261/comments","statuses_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/statuses/fe829f2d8a0404b247a6091d6f2a4943bac95f11","head":{"label":"laurensmiers:master","ref":"master","sha":"fe829f2d8a0404b247a6091d6f2a4943bac95f11","user":{"login":"laurensmiers","id":8750023,"node_id":"MDQ6VXNlcjg3NTAwMjM=","avatar_url":"https://avatars3.githubusercontent.com/u/8750023?v=4","gravatar_id":"","url":"https://api.github.com/users/laurensmiers","html_url":"https://github.com/laurensmiers","followers_url":"https://api.github.com/users/laurensmiers/followers","following_url":"https://api.github.com/users/laurensmiers/following{/other_user}","gists_url":"https://api.github.com/users/laurensmiers/gists{/gist_id}","starred_url":"https://api.github.com/users/laurensmiers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laurensmiers/subscriptions","organizations_url":"https://api.github.com/users/laurensmiers/orgs","repos_url":"https://api.github.com/users/laurensmiers/repos","events_url":"https://api.github.com/users/laurensmiers/events{/privacy}","received_events_url":"https://api.github.com/users/laurensmiers/received_events","type":"User","site_admin":false},"repo":{"id":102535131,"node_id":"MDEwOlJlcG9zaXRvcnkxMDI1MzUxMzE=","name":"CMock","full_name":"laurensmiers/CMock","private":false,"owner":{"login":"laurensmiers","id":8750023,"node_id":"MDQ6VXNlcjg3NTAwMjM=","avatar_url":"https://avatars3.githubusercontent.com/u/8750023?v=4","gravatar_id":"","url":"https://api.github.com/users/laurensmiers","html_url":"https://github.com/laurensmiers","followers_url":"https://api.github.com/users/laurensmiers/followers","following_url":"https://api.github.com/users/laurensmiers/following{/other_user}","gists_url":"https://api.github.com/users/laurensmiers/gists{/gist_id}","starred_url":"https://api.github.com/users/laurensmiers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laurensmiers/subscriptions","organizations_url":"https://api.github.com/users/laurensmiers/orgs","repos_url":"https://api.github.com/users/laurensmiers/repos","events_url":"https://api.github.com/users/laurensmiers/events{/privacy}","received_events_url":"https://api.github.com/users/laurensmiers/received_events","type":"User","site_admin":false},"html_url":"https://github.com/laurensmiers/CMock","description":"CMock - Mock/stub generator for C","fork":true,"url":"https://api.github.com/repos/laurensmiers/CMock","forks_url":"https://api.github.com/repos/laurensmiers/CMock/forks","keys_url":"https://api.github.com/repos/laurensmiers/CMock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/laurensmiers/CMock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/laurensmiers/CMock/teams","hooks_url":"https://api.github.com/repos/laurensmiers/CMock/hooks","issue_events_url":"https://api.github.com/repos/laurensmiers/CMock/issues/events{/number}","events_url":"https://api.github.com/repos/laurensmiers/CMock/events","assignees_url":"https://api.github.com/repos/laurensmiers/CMock/assignees{/user}","branches_url":"https://api.github.com/repos/laurensmiers/CMock/branches{/branch}","tags_url":"https://api.github.com/repos/laurensmiers/CMock/tags","blobs_url":"https://api.github.com/repos/laurensmiers/CMock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/laurensmiers/CMock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/laurensmiers/CMock/git/refs{/sha}","trees_url":"https://api.github.com/repos/laurensmiers/CMock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/laurensmiers/CMock/statuses/{sha}","languages_url":"https://api.github.com/repos/laurensmiers/CMock/languages","stargazers_url":"https://api.github.com/repos/laurensmiers/CMock/stargazers","contributors_url":"https://api.github.com/repos/laurensmiers/CMock/contributors","subscribers_url":"https://api.github.com/repos/laurensmiers/CMock/subscribers","subscription_url":"https://api.github.com/repos/laurensmiers/CMock/subscription","commits_url":"https://api.github.com/repos/laurensmiers/CMock/commits{/sha}","git_commits_url":"https://api.github.com/repos/laurensmiers/CMock/git/commits{/sha}","comments_url":"https://api.github.com/repos/laurensmiers/CMock/comments{/number}","issue_comment_url":"https://api.github.com/repos/laurensmiers/CMock/issues/comments{/number}","contents_url":"https://api.github.com/repos/laurensmiers/CMock/contents/{+path}","compare_url":"https://api.github.com/repos/laurensmiers/CMock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/laurensmiers/CMock/merges","archive_url":"https://api.github.com/repos/laurensmiers/CMock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/laurensmiers/CMock/downloads","issues_url":"https://api.github.com/repos/laurensmiers/CMock/issues{/number}","pulls_url":"https://api.github.com/repos/laurensmiers/CMock/pulls{/number}","milestones_url":"https://api.github.com/repos/laurensmiers/CMock/milestones{/number}","notifications_url":"https://api.github.com/repos/laurensmiers/CMock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/laurensmiers/CMock/labels{/name}","releases_url":"https://api.github.com/repos/laurensmiers/CMock/releases{/id}","deployments_url":"https://api.github.com/repos/laurensmiers/CMock/deployments","created_at":"2017-09-05T22:19:58Z","updated_at":"2019-11-11T12:29:57Z","pushed_at":"2019-11-11T12:29:54Z","git_url":"git://github.com/laurensmiers/CMock.git","ssh_url":"git@github.com:laurensmiers/CMock.git","clone_url":"https://github.com/laurensmiers/CMock.git","svn_url":"https://github.com/laurensmiers/CMock","homepage":"http://throwtheswitch.org","size":3417,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ThrowTheSwitch:master","ref":"master","sha":"ee3ae84e6487baf40a609742019b269ee3b492d4","user":{"login":"ThrowTheSwitch","id":1049138,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNDkxMzg=","avatar_url":"https://avatars3.githubusercontent.com/u/1049138?v=4","gravatar_id":"","url":"https://api.github.com/users/ThrowTheSwitch","html_url":"https://github.com/ThrowTheSwitch","followers_url":"https://api.github.com/users/ThrowTheSwitch/followers","following_url":"https://api.github.com/users/ThrowTheSwitch/following{/other_user}","gists_url":"https://api.github.com/users/ThrowTheSwitch/gists{/gist_id}","starred_url":"https://api.github.com/users/ThrowTheSwitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThrowTheSwitch/subscriptions","organizations_url":"https://api.github.com/users/ThrowTheSwitch/orgs","repos_url":"https://api.github.com/users/ThrowTheSwitch/repos","events_url":"https://api.github.com/users/ThrowTheSwitch/events{/privacy}","received_events_url":"https://api.github.com/users/ThrowTheSwitch/received_events","type":"Organization","site_admin":false},"repo":{"id":3276848,"node_id":"MDEwOlJlcG9zaXRvcnkzMjc2ODQ4","name":"CMock","full_name":"ThrowTheSwitch/CMock","private":false,"owner":{"login":"ThrowTheSwitch","id":1049138,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNDkxMzg=","avatar_url":"https://avatars3.githubusercontent.com/u/1049138?v=4","gravatar_id":"","url":"https://api.github.com/users/ThrowTheSwitch","html_url":"https://github.com/ThrowTheSwitch","followers_url":"https://api.github.com/users/ThrowTheSwitch/followers","following_url":"https://api.github.com/users/ThrowTheSwitch/following{/other_user}","gists_url":"https://api.github.com/users/ThrowTheSwitch/gists{/gist_id}","starred_url":"https://api.github.com/users/ThrowTheSwitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThrowTheSwitch/subscriptions","organizations_url":"https://api.github.com/users/ThrowTheSwitch/orgs","repos_url":"https://api.github.com/users/ThrowTheSwitch/repos","events_url":"https://api.github.com/users/ThrowTheSwitch/events{/privacy}","received_events_url":"https://api.github.com/users/ThrowTheSwitch/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ThrowTheSwitch/CMock","description":"CMock - Mock/stub generator for C","fork":false,"url":"https://api.github.com/repos/ThrowTheSwitch/CMock","forks_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/forks","keys_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/teams","hooks_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/hooks","issue_events_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/issues/events{/number}","events_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/events","assignees_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/assignees{/user}","branches_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/branches{/branch}","tags_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/tags","blobs_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/git/refs{/sha}","trees_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/statuses/{sha}","languages_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/languages","stargazers_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/stargazers","contributors_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/contributors","subscribers_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/subscribers","subscription_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/subscription","commits_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/commits{/sha}","git_commits_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/git/commits{/sha}","comments_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/comments{/number}","issue_comment_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/issues/comments{/number}","contents_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/contents/{+path}","compare_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/merges","archive_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/downloads","issues_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/issues{/number}","pulls_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/pulls{/number}","milestones_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/milestones{/number}","notifications_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/labels{/name}","releases_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/releases{/id}","deployments_url":"https://api.github.com/repos/ThrowTheSwitch/CMock/deployments","created_at":"2012-01-26T19:51:32Z","updated_at":"2019-11-05T04:21:12Z","pushed_at":"2019-11-11T12:29:56Z","git_url":"git://github.com/ThrowTheSwitch/CMock.git","ssh_url":"git@github.com:ThrowTheSwitch/CMock.git","clone_url":"https://github.com/ThrowTheSwitch/CMock.git","svn_url":"https://github.com/ThrowTheSwitch/CMock","homepage":"http://throwtheswitch.org","size":3385,"stargazers_count":276,"watchers_count":276,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":149,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":56,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":149,"open_issues":56,"watchers":276,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ThrowTheSwitch/CMock/pulls/261"},"html":{"href":"https://github.com/ThrowTheSwitch/CMock/pull/261"},"issue":{"href":"https://api.github.com/repos/ThrowTheSwitch/CMock/issues/261"},"comments":{"href":"https://api.github.com/repos/ThrowTheSwitch/CMock/issues/261/comments"},"review_comments":{"href":"https://api.github.com/repos/ThrowTheSwitch/CMock/pulls/261/comments"},"review_comment":{"href":"https://api.github.com/repos/ThrowTheSwitch/CMock/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ThrowTheSwitch/CMock/pulls/261/commits"},"statuses":{"href":"https://api.github.com/repos/ThrowTheSwitch/CMock/statuses/fe829f2d8a0404b247a6091d6f2a4943bac95f11"}},"author_association":"CONTRIBUTOR"}}
other: {"actor":{"display_login":"mvandervoord"}}