blob: 30ec7e6b899365e6b7b205524f117f33d80adf9d [file] [log] [blame]
.. title:: clang-tidy - readability-use-concise-preprocessor-directives
readability-use-concise-preprocessor-directives
===============================================
Finds uses of ``#if`` that can be simplified to ``#ifdef`` or ``#ifndef`` and,
since C23 and C++23, uses of ``#elif`` that can be simplified to ``#elifdef``
or ``#elifndef``:
.. code-block:: c++
#if defined(MEOW)
#if !defined(MEOW)
// becomes
#ifdef MEOW
#ifndef MEOW
Since C23 and C++23:
.. code-block:: c++
#elif defined(MEOW)
#elif !defined(MEOW)
// becomes
#elifdef MEOW
#elifndef MEOW