ThrowTheSwitch / CMock

CMock - Mock/stub generator for C
http://throwtheswitch.org
MIT License
671 stars 273 forks source link

add check to prevent sizeof(void) generation #457

Closed Hannes103 closed 1 year ago

Hannes103 commented 1 year ago

Mock generation by the Return_Thru_Ptr plugin can result in a sizeof(void) expression to be generated if a mocked function contains a void*-argument.

A previous implementation (some versions ago) generated the resulting mock with a sizeof(*<parameter name>), the current implementation uses sizeof(<typename without ptr>) if the parameter is a pointer.

This pull request adds a check to verify that the argument type is not a pointer to void, if it is then sizeof(*<parameter name>) will be generated. For me this fixes the issue.

Im no professional ruby developer so im always happy for feedback :)

Relevant issue: https://github.com/ThrowTheSwitch/Ceedling/issues/795