tidy - readability-redundant-preprocessor — Extra Clang Tools 22.0.0git documentation (original) (raw)

Finds potentially redundant preprocessor directives. At the moment the following cases are detected:

#ifdef FOO #ifdef FOO // inner ifdef is considered redundant void f(); #endif #endif

#ifndef FOO #ifndef FOO // inner ifndef is considered redundant void f(); #endif #endif

#ifdef FOO #ifndef FOO // inner ifndef is considered redundant void f(); #endif #endif

#ifndef FOO #ifdef FOO // inner ifdef is considered redundant void f(); #endif #endif

#define FOO 4 #if FOO == 4 #if FOO == 4 // inner if is considered redundant void f(); #endif #endif