1 // RUN: %check_clang_tidy %s readability-redundant-preprocessor %t -- -- -DFOO
2 
3 // Positive testing.
4 #ifdef FOO
5 // CHECK-NOTES: [[@LINE+1]]:2: warning: nested redundant #ifdef; consider removing it [readability-redundant-preprocessor]
6 #ifdef FOO
7 // CHECK-NOTES: [[@LINE-3]]:2: note: previous #ifdef was here
8 void f();
9 #endif
10 #endif
11 
12 // Positive testing of inverted condition.
13 #ifdef FOO
14 // CHECK-NOTES: [[@LINE+1]]:2: warning: nested redundant #ifndef; consider removing it [readability-redundant-preprocessor]
15 #ifndef FOO
16 // CHECK-NOTES: [[@LINE-3]]:2: note: previous #ifdef was here
17 void f2();
18 #endif
19 #endif
20 
21 // Negative testing.
22 #ifdef BAR
23 void g();
24 #endif
25 
26 #ifdef FOO
27 #ifdef BAR
28 void h();
29 #endif
30 #endif
31 
32 #ifdef FOO
33 #ifndef BAR
34 void i();
35 #endif
36 #endif
37