forked from qt-creator/qt-creator
[C++] Rewrite of the preprocessor.
This rewrite fixes a couple of issues with the pre-processor. It now supports: - macros in macro bodies - stringification of parameters [cpp.stringize] - the concatenation operator [cpp.concat] - #include MACRO_HERE - defined() inside macro bodies used in pp-conditions. Change-Id: Ifdb78041fb6afadf44f939a4bd66ce2832b8601f Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
36
tests/auto/cplusplus/preprocessor/data/macro-test.cpp
Normal file
36
tests/auto/cplusplus/preprocessor/data/macro-test.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#define USE(MY_USE) (defined MY_USE_##MY_USE && MY_USE_##MY_USE)
|
||||
|
||||
#define MY_USE_FEATURE1 1
|
||||
#define MY_USE_FEATURE2 0
|
||||
|
||||
#if USE(FEATURE1)
|
||||
void thisFunctionIsEnabled();
|
||||
#endif
|
||||
|
||||
#if USE(FEATURE2)
|
||||
void thisFunctionIsDisabled();
|
||||
#endif
|
||||
|
||||
#if USE(FEATURE3)
|
||||
void thisFunctionIsAlsoDisabled();
|
||||
#endif
|
||||
|
||||
#define USE2(MY_USE) (defined MY_USE_##MY_USE)
|
||||
|
||||
#if USE2(FEATURE1)
|
||||
void thisFunctionIsEnabled2();
|
||||
#endif
|
||||
|
||||
#if USE2(FEATURE3)
|
||||
void thisFunctionIsDisabled2();
|
||||
#endif
|
||||
|
||||
#define USE3(MY_USE) (MY_USE_##MY_USE)
|
||||
|
||||
#if USE3(FEATURE1)
|
||||
void thisFunctionIsEnabled3();
|
||||
#endif
|
||||
|
||||
#if USE3(FEATURE2)
|
||||
void thisFunctionIsDisabled3();
|
||||
#endif
|
Reference in New Issue
Block a user