|
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] |
| 1 | +// RUN: %check_clang_tidy -std=c++98 -check-suffixes=,CXX %s readability-use-concise-preprocessor-directives %t |
| 2 | +// RUN: %check_clang_tidy -std=c++11 -check-suffixes=,CXX %s readability-use-concise-preprocessor-directives %t |
| 3 | +// RUN: %check_clang_tidy -std=c++14 -check-suffixes=,CXX %s readability-use-concise-preprocessor-directives %t |
| 4 | +// RUN: %check_clang_tidy -std=c++17 -check-suffixes=,CXX %s readability-use-concise-preprocessor-directives %t |
| 5 | +// RUN: %check_clang_tidy -std=c++20 -check-suffixes=,CXX %s readability-use-concise-preprocessor-directives %t |
| 6 | +// RUN: %check_clang_tidy -std=c++23-or-later -check-suffixes=,23,CXX,CXX23 %s readability-use-concise-preprocessor-directives %t |
| 7 | + |
| 8 | +// RUN: %check_clang_tidy -std=c99 %s readability-use-concise-preprocessor-directives %t -- -- -x c |
| 9 | +// RUN: %check_clang_tidy -std=c11 %s readability-use-concise-preprocessor-directives %t -- -- -x c |
| 10 | +// RUN: %check_clang_tidy -std=c23-or-later -check-suffixes=,23 %s readability-use-concise-preprocessor-directives %t -- -- -x c |
| 11 | + |
| 12 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifdef [readability-use-concise-preprocessor-directives] |
13 | 13 | // CHECK-FIXES: #ifdef FOO |
14 | 14 | #if defined(FOO) |
15 | | -// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifdef [modernize-use-concise-preprocessor-directives] |
| 15 | +// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifdef [readability-use-concise-preprocessor-directives] |
16 | 16 | // CHECK-FIXES-23: #elifdef BAR |
17 | 17 | #elif defined(BAR) |
18 | 18 | #endif |
19 | 19 |
|
20 | | -// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifdef [modernize-use-concise-preprocessor-directives] |
| 20 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifdef [readability-use-concise-preprocessor-directives] |
21 | 21 | // CHECK-FIXES: #ifdef FOO |
22 | 22 | #if defined FOO |
23 | | -// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifdef [modernize-use-concise-preprocessor-directives] |
| 23 | +// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifdef [readability-use-concise-preprocessor-directives] |
24 | 24 | // CHECK-FIXES-23: #elifdef BAR |
25 | 25 | #elif defined BAR |
26 | 26 | #endif |
27 | 27 |
|
28 | | -// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifdef [modernize-use-concise-preprocessor-directives] |
| 28 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifdef [readability-use-concise-preprocessor-directives] |
29 | 29 | // CHECK-FIXES: #ifdef FOO |
30 | 30 | #if (defined(FOO)) |
31 | | -// CHECK-MESSAGES-23: :[[@LINE+2]]:4: warning: preprocessor condition can be written more concisely using #elifdef [modernize-use-concise-preprocessor-directives] |
| 31 | +// CHECK-MESSAGES-23: :[[@LINE+2]]:4: warning: preprocessor condition can be written more concisely using #elifdef [readability-use-concise-preprocessor-directives] |
32 | 32 | // CHECK-FIXES-23: # elifdef BAR |
33 | 33 | # elif (defined(BAR)) |
34 | 34 | #endif |
35 | 35 |
|
36 | | -// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifdef [modernize-use-concise-preprocessor-directives] |
| 36 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifdef [readability-use-concise-preprocessor-directives] |
37 | 37 | // CHECK-FIXES: #ifdef FOO |
38 | 38 | #if (defined FOO) |
39 | | -// CHECK-MESSAGES-23: :[[@LINE+2]]:4: warning: preprocessor condition can be written more concisely using #elifdef [modernize-use-concise-preprocessor-directives] |
| 39 | +// CHECK-MESSAGES-23: :[[@LINE+2]]:4: warning: preprocessor condition can be written more concisely using #elifdef [readability-use-concise-preprocessor-directives] |
40 | 40 | // CHECK-FIXES-23: # elifdef BAR |
41 | 41 | # elif (defined BAR) |
42 | 42 | #endif |
43 | 43 |
|
44 | | -// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 44 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [readability-use-concise-preprocessor-directives] |
45 | 45 | // CHECK-FIXES: #ifndef FOO |
46 | 46 | #if !defined(FOO) |
47 | | -// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [modernize-use-concise-preprocessor-directives] |
| 47 | +// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [readability-use-concise-preprocessor-directives] |
48 | 48 | // CHECK-FIXES-23: #elifndef BAR |
49 | 49 | #elif !defined(BAR) |
50 | 50 | #endif |
51 | 51 |
|
52 | 52 | #ifdef __cplusplus |
53 | | -// CHECK-MESSAGES-CXX: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 53 | +// CHECK-MESSAGES-CXX: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [readability-use-concise-preprocessor-directives] |
54 | 54 | // CHECK-FIXES-CXX: #ifndef FOO |
55 | 55 | #if not defined(FOO) |
56 | | -// CHECK-MESSAGES-CXX23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [modernize-use-concise-preprocessor-directives] |
| 56 | +// CHECK-MESSAGES-CXX23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [readability-use-concise-preprocessor-directives] |
57 | 57 | // CHECK-FIXES-CXX23: #elifndef BAR |
58 | 58 | #elif not defined(BAR) |
59 | 59 | #endif |
60 | 60 | #endif // __cplusplus |
61 | 61 |
|
62 | | -// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 62 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [readability-use-concise-preprocessor-directives] |
63 | 63 | // CHECK-FIXES: #ifndef FOO |
64 | 64 | #if !defined FOO |
65 | | -// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [modernize-use-concise-preprocessor-directives] |
| 65 | +// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [readability-use-concise-preprocessor-directives] |
66 | 66 | // CHECK-FIXES-23: #elifndef BAR |
67 | 67 | #elif !defined BAR |
68 | 68 | #endif |
69 | 69 |
|
70 | 70 | #ifdef __cplusplus |
71 | | -// CHECK-MESSAGES-CXX: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 71 | +// CHECK-MESSAGES-CXX: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [readability-use-concise-preprocessor-directives] |
72 | 72 | // CHECK-FIXES-CXX: #ifndef FOO |
73 | 73 | #if not defined FOO |
74 | | -// CHECK-MESSAGES-CXX23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [modernize-use-concise-preprocessor-directives] |
| 74 | +// CHECK-MESSAGES-CXX23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [readability-use-concise-preprocessor-directives] |
75 | 75 | // CHECK-FIXES-CXX23: #elifndef BAR |
76 | 76 | #elif not defined BAR |
77 | 77 | #endif |
78 | 78 | #endif // __cplusplus |
79 | 79 |
|
80 | | -// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 80 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [readability-use-concise-preprocessor-directives] |
81 | 81 | // CHECK-FIXES: #ifndef FOO |
82 | 82 | #if (!defined(FOO)) |
83 | | -// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [modernize-use-concise-preprocessor-directives] |
| 83 | +// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [readability-use-concise-preprocessor-directives] |
84 | 84 | // CHECK-FIXES-23: #elifndef BAR |
85 | 85 | #elif (!defined(BAR)) |
86 | 86 | #endif |
87 | 87 |
|
88 | | -// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 88 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [readability-use-concise-preprocessor-directives] |
89 | 89 | // CHECK-FIXES: #ifndef FOO |
90 | 90 | #if (!defined FOO) |
91 | | -// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [modernize-use-concise-preprocessor-directives] |
| 91 | +// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [readability-use-concise-preprocessor-directives] |
92 | 92 | // CHECK-FIXES-23: #elifndef BAR |
93 | 93 | #elif (!defined BAR) |
94 | 94 | #endif |
95 | 95 |
|
96 | | -// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 96 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [readability-use-concise-preprocessor-directives] |
97 | 97 | // CHECK-FIXES: #ifndef FOO |
98 | 98 | #if !(defined(FOO)) |
99 | | -// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [modernize-use-concise-preprocessor-directives] |
| 99 | +// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [readability-use-concise-preprocessor-directives] |
100 | 100 | // CHECK-FIXES-23: #elifndef BAR |
101 | 101 | #elif !(defined(BAR)) |
102 | 102 | #endif |
103 | 103 |
|
104 | | -// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 104 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [readability-use-concise-preprocessor-directives] |
105 | 105 | // CHECK-FIXES: #ifndef FOO |
106 | 106 | #if !(defined FOO) |
107 | | -// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [modernize-use-concise-preprocessor-directives] |
| 107 | +// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifndef [readability-use-concise-preprocessor-directives] |
108 | 108 | // CHECK-FIXES-23: #elifndef BAR |
109 | 109 | #elif !(defined BAR) |
110 | 110 | #endif |
|
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: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 116 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [readability-use-concise-preprocessor-directives] |
117 | 117 | // CHECK-FIXES: #ifndef FOO |
118 | 118 | #if !((!!(defined(FOO)))) |
119 | | -// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifdef [modernize-use-concise-preprocessor-directives] |
| 119 | +// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifdef [readability-use-concise-preprocessor-directives] |
120 | 120 | // CHECK-FIXES-23: #elifdef BAR |
121 | 121 | #elif ((!(!(defined(BAR))))) |
122 | 122 | #endif |
123 | 123 |
|
124 | | -// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [modernize-use-concise-preprocessor-directives] |
| 124 | +// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #ifndef [readability-use-concise-preprocessor-directives] |
125 | 125 | // CHECK-FIXES: #ifndef FOO |
126 | 126 | #if !((!!(defined FOO))) |
127 | | -// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifdef [modernize-use-concise-preprocessor-directives] |
| 127 | +// CHECK-MESSAGES-23: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using #elifdef [readability-use-concise-preprocessor-directives] |
128 | 128 | // CHECK-FIXES-23: #elifdef BAR |
129 | 129 | #elif ((!(!(defined BAR)))) |
130 | 130 | #endif |
|
0 commit comments