SCons/scons

C/C++ scanner: add #elifdef and #elifndef

Opened this issue · 1 comments

C++23 introduces #elifdef and #elifdef in the preprocessor: https://en.cppreference.com/w/cpp/preprocessor/conditional

// Note that if a compiler does not support C++23's #elifdef/#elifndef
// directives then the "unexpected" block (see below) will be selected.
#ifdef CPU
    std::cout << "4: no1\n";
#elifdef GPU
    std::cout << "4: no2\n";
#elifndef RAM
    std::cout << "4: yes\n"; // expected block
#else
    std::cout << "4: no!\n"; // unexpectedly selects this block by skipping
                             // unknown directives and "jumping" directly
                             // from "#ifdef CPU" to this "#else" block
#endif

Applies to C23 as well. For grins, here's the example from the C standard:

#ifdef __STDC__
#define TITLE "ISO C Compilation"
#elifndef __cplusplus
#define TITLE "Non-ISO C Compilation"
#else
/* C++ */
#define