31 lines · plain
1.. title:: clang-tidy - readability-use-concise-preprocessor-directives2 3readability-use-concise-preprocessor-directives4===============================================5 6Finds uses of ``#if`` that can be simplified to ``#ifdef`` or ``#ifndef`` and,7since C23 and C++23, uses of ``#elif`` that can be simplified to ``#elifdef``8or ``#elifndef``:9 10.. code-block:: c++11 12 #if defined(MEOW)13 #if !defined(MEOW)14 15 // becomes16 17 #ifdef MEOW18 #ifndef MEOW19 20Since C23 and C++23:21 22.. code-block:: c++23 24 #elif defined(MEOW)25 #elif !defined(MEOW)26 27 // becomes28 29 #elifdef MEOW30 #elifndef MEOW31