Open jkuban opened 7 years ago
You've made the decision that only your main module will use a function declared static in a header, but this isn't enforced by the C standard. Therefore, CMock supports either case.
If you want them to stay private, they should be in your C file, not your header file. Otherwise every module who includes this head gets their own (private) static declaration of those functions. They COULD theoretically implement and use those functions.
Maybe this should be treated the same as the extern keyword and have an option in CMock in :include or :exclude these functions? Would that solve your needs?
I think it is a good idea to have a special option like the "extern" option. But if this is not conform to the C standard, I don't know, if it is really necessary. I understand your point of view. Thanks!
I will write unit tests of my C module which calls functions from another C -modul. The other C modul has a public header (static and none static function prototypes). The function prototypes in this public header will be used to generate CMock functions. But why CMock generates mock functions also from static function prototypes? The static functions in the header file will never be called, except from the none static functions. And the code in the none static functions will never be called during unit testing, because the functions are mocked. What is the need of generating the CMock functions from static functions?