37 lines · cpp
1// RUN: %check_clang_tidy %s readability-redundant-preprocessor %t -- -- -DFOO2 3// Positive testing.4#ifdef FOO5// CHECK-NOTES: [[@LINE+1]]:2: warning: nested redundant #ifdef; consider removing it [readability-redundant-preprocessor]6#ifdef FOO7// CHECK-NOTES: [[@LINE-3]]:2: note: previous #ifdef was here8void f();9#endif10#endif11 12// Positive testing of inverted condition.13#ifdef FOO14// CHECK-NOTES: [[@LINE+1]]:2: warning: nested redundant #ifndef; consider removing it [readability-redundant-preprocessor]15#ifndef FOO16// CHECK-NOTES: [[@LINE-3]]:2: note: previous #ifdef was here17void f2();18#endif19#endif20 21// Negative testing.22#ifdef BAR23void g();24#endif25 26#ifdef FOO27#ifdef BAR28void h();29#endif30#endif31 32#ifdef FOO33#ifndef BAR34void i();35#endif36#endif37