diff options
Diffstat (limited to 'tests/preprocessor')
| -rw-r--r-- | tests/preprocessor/recursive-macro.slang | 20 | ||||
| -rw-r--r-- | tests/preprocessor/repeated-macro-expansion.slang | 16 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/preprocessor/recursive-macro.slang b/tests/preprocessor/recursive-macro.slang index 1f776ca72..ac99687b2 100644 --- a/tests/preprocessor/recursive-macro.slang +++ b/tests/preprocessor/recursive-macro.slang @@ -22,4 +22,24 @@ int NO_EXPAND(b) { return b + ARG_EXPAND(ARG_EXPAND(1)); +} + +// The same issue can arise for object-like macros and not +// just function-like, so we will test that case here as well. + +int objectLikeMacroTest( int REC ) +{ +#define REC REC + + return REC; +} + +// We also need to check the case where macros are +// mutually, rather than directly, recursive + +int mutuallyRecursiveMacroTest( int XYZ ) +{ + #define ABC XYZ + #define XYZ ABC + return XYZ; }
\ No newline at end of file diff --git a/tests/preprocessor/repeated-macro-expansion.slang b/tests/preprocessor/repeated-macro-expansion.slang new file mode 100644 index 000000000..c42128933 --- /dev/null +++ b/tests/preprocessor/repeated-macro-expansion.slang @@ -0,0 +1,16 @@ +// macro-expansion.slang +// +//TEST:SIMPLE: + +// Test a bug where macro expansion isn't being +// triggered for back-to-back uses of a function-like +// macro. + +#define IGNORE(THING) /* empty */ + +void test() +{ + IGNORE(badStuff) + IGNORE(moreBad) + ; +} |
