Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Add -Wreserved-identifier supported by clang #1206

Commits on Feb 2, 2023

  1. build: Add -Wreserved-identifier supported by clang

    This warns on certain identifiers reserved by the C standard, namely
     * identifiers that begin with an underscore followed by an uppercase
       letter, and
     * identifiers in the global namespace that begin with an underscore.
    
    We had used such identifiers in the past for macros in include guards,
    and we should make sure that we don't reintroduce such identifiers
    going forward.
    
    Note that C reserves more identifiers for "future library directions",
    e.g., identifiers that begin with "str" followed by a lowercase letter.
    But even the C standards committee has decided that this is somewhat
    silly and adopted a proposal [1] for C23 that removes the restriction
    that programs using these identifiers have UB. Instead, these
    identifiers are now "potentially reserved", which is not a normative
    restriction but simply an informative warning that the identifiers
    may become fully reserved in the future.
    
    [1] https://www.open-std.org/jtc1/sc22/WG14/www/docs/n2625.pdf
    real-or-random committed Feb 2, 2023
    Configuration menu
    Copy the full SHA
    8c7e0fc View commit details
    Browse the repository at this point in the history