Skip to content

Commit d8b1d00

Browse files
authored
Merge pull request #18516 from jketema/preproc-1
C++: Uncomment preprocessor test cases and add addition `#if` test case
2 parents 2d0c73a + dca87f3 commit d8b1d00

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

cpp/ql/test/library-tests/preprocessor/preprocessor/pp.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,10 @@ int templateClassContext<T> :: val = MACRO_TEMPLATECLASSCONTEXT_REFERENCED;
6868

6969
#define INSTANTIATION
7070
templateClassContext<int> tcci;
71+
72+
#define BAR
73+
74+
#if defined(BAR) && \
75+
defined(BAR)
76+
#warning BAR defined
77+
#endif

cpp/ql/test/library-tests/preprocessor/preprocessor/pp.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
//#pragma byte_order(big_endian)
55
#warning "Not in Kansas any more"
66

7-
//#define MULTILINE \
7+
#define MULTILINE \
88
/* Hello */ \
99
world \
1010
/* from */ \
1111
a long \
1212
/* macro */
13-
//#undef \
13+
#undef \
1414
MULTILINE
1515

16-
//#include \
17-
<pp.h> \
16+
#include \
17+
"pp.h" \
1818
\

cpp/ql/test/library-tests/preprocessor/preprocessor/preproc.expected

+7
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@
2727
| pp.cpp:0:0:0:0 | pp.cpp | 60 | 3 | 60 | 21 | Macro | IN_TEMPLATE | |
2828
| pp.cpp:0:0:0:0 | pp.cpp | 61 | 1 | 61 | 7 | PreprocessorEndif | N/A | N/A |
2929
| pp.cpp:0:0:0:0 | pp.cpp | 69 | 1 | 69 | 21 | Macro | INSTANTIATION | |
30+
| pp.cpp:0:0:0:0 | pp.cpp | 72 | 1 | 72 | 11 | Macro | BAR | |
31+
| pp.cpp:0:0:0:0 | pp.cpp | 74 | 1 | 74 | 21 | PreprocessorIf | defined(BAR) && \\ | N/A |
32+
| pp.cpp:0:0:0:0 | pp.cpp | 76 | 1 | 76 | 20 | PreprocessorWarning | BAR defined | N/A |
33+
| pp.cpp:0:0:0:0 | pp.cpp | 77 | 1 | 77 | 6 | PreprocessorEndif | N/A | N/A |
3034
| pp.h:0:0:0:0 | pp.h | 1 | 1 | 1 | 12 | PreprocessorPragma | once | N/A |
3135
| pp.h:0:0:0:0 | pp.h | 3 | 1 | 3 | 27 | PreprocessorLine | 33 "emerald_city.h" | N/A |
3236
| pp.h:0:0:0:0 | pp.h | 5 | 1 | 5 | 33 | PreprocessorWarning | "Not in Kansas any more" | N/A |
37+
| pp.h:0:0:0:0 | pp.h | 7 | 1 | 11 | 8 | Macro | MULTILINE | world a long |
38+
| pp.h:0:0:0:0 | pp.h | 13 | 1 | 14 | 11 | PreprocessorUndef | MULTILINE | N/A |
39+
| pp.h:0:0:0:0 | pp.h | 16 | 1 | 17 | 8 | Include | "pp.h" | N/A |

0 commit comments

Comments
 (0)