-
-
Notifications
You must be signed in to change notification settings - Fork 262
Open
Description
In our project, we have defined a macro to force function inlining using __attribute__((always_inline))
, which is a fairly common practice — I’ve seen many projects use this technique.
The issue is that when Ceedling/CMock encounters a macro preceding a function declaration, it generates invalid mock files with invalid syntax.
temp2.h
:
#define INLINE inline
int a; // Another bug: without this dummy line, Ceedling does not generate any mocking for bar()
INLINE int bar(void) // Ceedling fails mocking this function
{
return 10;
}
I tried to change this setting in project.yml
from:
:cmock:
:strippables: ['(?:__attribute__\s*\([ (]*.*?[ )]*\)+)']
into (added |(INLINE)
):
:cmock:
:strippables: ['(?:__attribute__\s*\([ (]*.*?[ )]*\)+)|(INLINE)']
However, in this case, a different issue arises: the linker complains that bar()
is defined multiple times — once in temp2.h
and once in mock_temp2.c
Example project:
ceedling_test.zip
Metadata
Metadata
Assignees
Labels
No labels