ThrowTheSwitch / CMock

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

:strippable question/suggestion #458

Closed informatimago closed 8 months ago

informatimago commented 1 year ago

My understanding of :strippable is that it allows to give regular expressions that should match an "attribute" or macro call, and this matched string is removed.

Currently, this is done before concatenating multi-line declarations into a single line.

So if the macro "call" may cover several lines it will be harder to write the regexp to match it.

Then, I've noticed that it's used to actually remove a declaration from consideration for mocking, by matching the name of the function that we don't want cmock to process. That prevented the regexp identifying the function declaration to match and seemed to work, but with my patch that implements a small parser, it just gives a parsing error instead (perhaps I should ignore these?)

This leds me to suggest the following modification and addition:

If this seems acceptable, I will implement it (already done half of it).

Letme commented 1 year ago

I would love to keep strippable backwards compatible so I am a bit afraid what will happen if you move it to after concatenating multi-line declarations, as I have no idea how far that goes. When you remove something with certain define it helps reduce the number of needed includes for the mocks. It is not about non-mocked functions but it is about

STATIC INLINE blah(int bla) to end up as blah(int bla), and I do not want to list every single function in my project that needs this stripped (hence I have only STATIC and INLINE in my strippables.

informatimago commented 1 year ago

Ok, so I shall leave strippable alone and only have a new feature to disable mocking certain functions.