-
-
Notifications
You must be signed in to change notification settings - Fork 293
Open
Description
// Works for GCC and Clang compiler
#if defined(__GNUC__) || defined(__clang__)
#define PACK(...) __VA_ARGS__ __attribute__((__packed__))
#endif
// Works for Microsoft compilers
#if _MSC_VER
#define PACK(...) __pragma(pack(push, 1)) __VA_ARGS__ __pragma(pack(pop))
#endif
typedef PACK(struct {
int a;
int b;
}) my_struct;
PACK(struct my_struct2 {
int a;
int b;
});
typedef PACK(enum {
ENUM1 = 1,
ENUM2,
}) my_enum;
PACK(enum my_enum2 {
ENUM_1 = 1,
ENUM_2,
});
CMock can't mock files that contain code wrapped in macros, so I'm looking for a regex that can help me remove the PACK()
macro during mocking.
I tried to use PACK\s*\(\s*((?:.|\n)*?)\s*\)
regex in the project.yml
as follow, but it doesn't work:
:cmock:
:strippables:
- '(?:__attribute__\s*\([ (]*.*?[ )]*\)+)'
- '(PACK\s*\(\s*((?:.|\n)*?)\s*\))'
(I'm not sure if it's allowed to enter multiple regular expressions like I did above)
Metadata
Metadata
Assignees
Labels
No labels