[PATCH] D130800: [clang][Headers] Avoid compiler warnings in builtin headers

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 1 12:08:31 PDT 2022


aaron.ballman added a comment.

Thanks for catching this! As far as these changes go, they're pretty reasonable, but don't seem like they hit all of the problem areas. There's 20+ occurrences of `#if __STDC_VERSION__` and 10+ of `#if __cplusplus` in lib/Headers; shouldn't they all be updated?



================
Comment at: clang/lib/Headers/stdint.h:94-95
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmacro-redefined"
+
----------------
It seems to me that a cleaner approach to this is to `#undef` the macros we expect to be redefining before we redefine them instead of disabling the definition warning entirely. For example, it would still be useful for a user to find out that our stdint.h redefines some symbol from their own header files from an earlier inclusion.


================
Comment at: clang/lib/Headers/stdint.h:503
    in C2x mode; switch to the correct values once they've been published. */
 #if __STDC_VERSION__ >= 202000L
 # define UINT_LEAST64_WIDTH __UINT_LEAST64_WIDTH
----------------
Why does this usage not need to be changed?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130800/new/

https://reviews.llvm.org/D130800



More information about the cfe-commits mailing list