|
1 | | -// RUN: %check_clang_tidy -std=c++98 -check-suffixes=ALL,CXX %s modernize-use-concise-preprocessor-directives %t |
2 | | -// RUN: %check_clang_tidy -std=c++11 -check-suffixes=ALL,CXX %s modernize-use-concise-preprocessor-directives %t |
3 | | -// RUN: %check_clang_tidy -std=c++14 -check-suffixes=ALL,CXX %s modernize-use-concise-preprocessor-directives %t |
4 | | -// RUN: %check_clang_tidy -std=c++17 -check-suffixes=ALL,CXX %s modernize-use-concise-preprocessor-directives %t |
5 | | -// RUN: %check_clang_tidy -std=c++20 -check-suffixes=ALL,CXX %s modernize-use-concise-preprocessor-directives %t |
6 | | -// RUN: %check_clang_tidy -std=c++23-or-later -check-suffixes=ALL,23,CXX,CXX23 %s modernize-use-concise-preprocessor-directives %t |
7 | | - |
8 | | -// RUN: %check_clang_tidy -std=c99 -check-suffix=ALL %s modernize-use-concise-preprocessor-directives %t -- -- -x c |
9 | | -// RUN: %check_clang_tidy -std=c11 -check-suffix=ALL %s modernize-use-concise-preprocessor-directives %t -- -- -x c |
10 | | -// RUN: %check_clang_tidy -std=c23-or-later -check-suffix=ALL,23 %s modernize-use-concise-preprocessor-directives %t -- -- -x c |
11 | | - |
12 | | -// CHECK-MESSAGES-ALL: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifdef [modernize-use-concise-preprocessor-directives] |
13 | | -// CHECK-FIXES-ALL: #ifdef FOO |
| 1 | +// RUN: %check_clang_tidy -std=c++98 -check-suffixes=,CXX %s modernize-use-concise-preprocessor-directives %t |
| 2 | +// RUN: %check_clang_tidy -std=c++11 -check-suffixes=,CXX %s modernize-use-concise-preprocessor-directives %t |
| 3 | +// RUN: %check_clang_tidy -std=c++14 -check-suffixes=,CXX %s modernize-use-concise-preprocessor-directives %t |
| 4 | +// RUN: %check_clang_tidy -std=c++17 -check-suffixes=,CXX %s modernize-use-concise-preprocessor-directives %t |
| 5 | +// RUN: %check_clang_tidy -std=c++20 -check-suffixes=,CXX %s modernize-use-concise-preprocessor-directives %t |
| 6 | +// RUN: %check_clang_tidy -std=c++23-or-later -check-suffixes=,23,CXX,CXX23 %s modernize-use-concise-preprocessor-directives %t |
| 7 | + |
| 8 | +// RUN: %check_clang_tidy -std=c99 %s modernize-use-concise-preprocessor-directives %t -- -- -x c |
| 9 | +// RUN: %check_clang_tidy -std=c11 %s modernize-use-concise-preprocessor-directives %t -- -- -x c |
| 10 | +// RUN: %check_clang_tidy -std=c23-or-later -check-suffixes=,23 %s modernize-use-concise-preprocessor-directives %t -- -- -x c |
| 11 | + |
| 12 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifdef [modernize-use-concise-preprocessor-directives] |
| 13 | +// CHECK-FIXES: #ifdef FOO |
14 | 14 | #if defined(FOO) |
15 | 15 | // CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifdef [modernize-use-concise-preprocessor-directives] |
16 | 16 | // CHECK-FIXES-23: #elifdef BAR |
17 | 17 | #elif defined(BAR) |
18 | 18 | #endif |
19 | 19 |
|
20 | | -// CHECK-MESSAGES-ALL: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifdef [modernize-use-concise-preprocessor-directives] |
21 | | -// CHECK-FIXES-ALL: #ifdef FOO |
| 20 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifdef [modernize-use-concise-preprocessor-directives] |
| 21 | +// CHECK-FIXES: #ifdef FOO |
22 | 22 | #if defined FOO |
23 | 23 | // CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifdef [modernize-use-concise-preprocessor-directives] |
24 | 24 | // CHECK-FIXES-23: #elifdef BAR |
25 | 25 | #elif defined BAR |
26 | 26 | #endif |
27 | 27 |
|
28 | | -// CHECK-MESSAGES-ALL: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifdef [modernize-use-concise-preprocessor-directives] |
29 | | -// CHECK-FIXES-ALL: #ifdef FOO |
| 28 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifdef [modernize-use-concise-preprocessor-directives] |
| 29 | +// CHECK-FIXES: #ifdef FOO |
30 | 30 | #if (defined(FOO)) |
31 | 31 | // CHECK-MESSAGES-23: :[[@LINE+2]]:4: warning: preprocessor condition can be written more concisely using #elifdef [modernize-use-concise-preprocessor-directives] |
32 | 32 | // CHECK-FIXES-23: # elifdef BAR |
33 | 33 | # elif (defined(BAR)) |
34 | 34 | #endif |
35 | 35 |
|
36 | | -// CHECK-MESSAGES-ALL: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifdef [modernize-use-concise-preprocessor-directives] |
37 | | -// CHECK-FIXES-ALL: #ifdef FOO |
| 36 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifdef [modernize-use-concise-preprocessor-directives] |
| 37 | +// CHECK-FIXES: #ifdef FOO |
38 | 38 | #if (defined FOO) |
39 | 39 | // CHECK-MESSAGES-23: :[[@LINE+2]]:4: warning: preprocessor condition can be written more concisely using #elifdef [modernize-use-concise-preprocessor-directives] |
40 | 40 | // CHECK-FIXES-23: # elifdef BAR |
41 | 41 | # elif (defined BAR) |
42 | 42 | #endif |
43 | 43 |
|
44 | | -// CHECK-MESSAGES-ALL: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
45 | | -// CHECK-FIXES-ALL: #ifndef FOO |
| 44 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 45 | +// CHECK-FIXES: #ifndef FOO |
46 | 46 | #if !defined(FOO) |
47 | 47 | // CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [modernize-use-concise-preprocessor-directives] |
48 | 48 | // CHECK-FIXES-23: #elifndef BAR |
|
59 | 59 | #endif |
60 | 60 | #endif // __cplusplus |
61 | 61 |
|
62 | | -// CHECK-MESSAGES-ALL: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
63 | | -// CHECK-FIXES-ALL: #ifndef FOO |
| 62 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 63 | +// CHECK-FIXES: #ifndef FOO |
64 | 64 | #if !defined FOO |
65 | 65 | // CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [modernize-use-concise-preprocessor-directives] |
66 | 66 | // CHECK-FIXES-23: #elifndef BAR |
|
77 | 77 | #endif |
78 | 78 | #endif // __cplusplus |
79 | 79 |
|
80 | | -// CHECK-MESSAGES-ALL: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
81 | | -// CHECK-FIXES-ALL: #ifndef FOO |
| 80 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 81 | +// CHECK-FIXES: #ifndef FOO |
82 | 82 | #if (!defined(FOO)) |
83 | 83 | // CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [modernize-use-concise-preprocessor-directives] |
84 | 84 | // CHECK-FIXES-23: #elifndef BAR |
85 | 85 | #elif (!defined(BAR)) |
86 | 86 | #endif |
87 | 87 |
|
88 | | -// CHECK-MESSAGES-ALL: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
89 | | -// CHECK-FIXES-ALL: #ifndef FOO |
| 88 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 89 | +// CHECK-FIXES: #ifndef FOO |
90 | 90 | #if (!defined FOO) |
91 | 91 | // CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [modernize-use-concise-preprocessor-directives] |
92 | 92 | // CHECK-FIXES-23: #elifndef BAR |
93 | 93 | #elif (!defined BAR) |
94 | 94 | #endif |
95 | 95 |
|
96 | | -// CHECK-MESSAGES-ALL: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
97 | | -// CHECK-FIXES-ALL: #ifndef FOO |
| 96 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 97 | +// CHECK-FIXES: #ifndef FOO |
98 | 98 | #if !(defined(FOO)) |
99 | 99 | // CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [modernize-use-concise-preprocessor-directives] |
100 | 100 | // CHECK-FIXES-23: #elifndef BAR |
101 | 101 | #elif !(defined(BAR)) |
102 | 102 | #endif |
103 | 103 |
|
104 | | -// CHECK-MESSAGES-ALL: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
105 | | -// CHECK-FIXES-ALL: #ifndef FOO |
| 104 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 105 | +// CHECK-FIXES: #ifndef FOO |
106 | 106 | #if !(defined FOO) |
107 | 107 | // CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [modernize-use-concise-preprocessor-directives] |
108 | 108 | // CHECK-FIXES-23: #elifndef BAR |
|
113 | 113 | // handling them doesn't really add any complexity to the implementation. |
114 | 114 | // Test them for good measure. |
115 | 115 |
|
116 | | -// CHECK-MESSAGES-ALL: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
117 | | -// CHECK-FIXES-ALL: #ifndef FOO |
| 116 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 117 | +// CHECK-FIXES: #ifndef FOO |
118 | 118 | #if !((!!(defined(FOO)))) |
119 | 119 | // CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifdef [modernize-use-concise-preprocessor-directives] |
120 | 120 | // CHECK-FIXES-23: #elifdef BAR |
121 | 121 | #elif ((!(!(defined(BAR))))) |
122 | 122 | #endif |
123 | 123 |
|
124 | | -// CHECK-MESSAGES-ALL: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
125 | | -// CHECK-FIXES-ALL: #ifndef FOO |
| 124 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 125 | +// CHECK-FIXES: #ifndef FOO |
126 | 126 | #if !((!!(defined FOO))) |
127 | 127 | // CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifdef [modernize-use-concise-preprocessor-directives] |
128 | 128 | // CHECK-FIXES-23: #elifdef BAR |
|
0 commit comments