Skip to content

[clang-tidy] Check request: modernize-use-elifdef-and-elifndef #132561

@denzor200

Description

@denzor200

C++23 suggests us #elifdef and #elifndef as a new way to write directives in a long conditional preprocessing block.
Needs a check that will find usages of #elif followed by defined identifier(or !defined identifier) and will suggest to change it to #elifdef identifier(or #elifndef identifier).

BEFORE:

#ifdef CPU
    std::cout << "4: no1\n";
#elif defined GPU
    std::cout << "4: no2\n";
#elif !defined RAM
    std::cout << "4: yes\n";
#endif

AFTER:

#ifdef CPU
    std::cout << "4: no1\n";
#elifdef GPU
    std::cout << "4: no2\n";
#elifndef RAM
    std::cout << "4: yes\n";
#endif

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions