Skip to content

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

Open
@delan

Description

@delan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C23Features new in the 2023 C Standardc++23Features new in the 2023 C++ Standardenhancementscanner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions