[PATCH] D115253: [C2x] Support the *_WIDTH macros in limits.h and stdint.h
James Y Knight via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 14 09:54:01 PST 2021
jyknight added inline comments.
================
Comment at: clang/lib/Frontend/InitPreprocessor.cpp:900-903
+ Builder.defineMacro("__USHRT_WIDTH__", Twine(TI.getShortWidth()));
+ Builder.defineMacro("__UINT_WIDTH__", Twine(TI.getIntWidth()));
+ Builder.defineMacro("__ULONG_WIDTH__", Twine(TI.getLongWidth()));
+ Builder.defineMacro("__ULLONG_WIDTH__", Twine(TI.getLongLongWidth()));
----------------
This seems odd? We define `__LONG_LONG_MAX__` but not `__LONG_LONG_WIDTH__`, for signed long long, and we define `__ULLONG_WIDTH__` but not `__ULLONG_MAX__`, for unsigned long long?
================
Comment at: clang/lib/Headers/stdint.h:728
+ in C2x mode; switch to the correct values once they've been published. */
+#if __STDC_VERSION__ >= 202000L
+/* NB: The C standard requires that these be the same value, but the compiler
----------------
Why are these conditioned on `__STDC_VERSION__` but the ones above, e.g. UINT64_WIDTH, are not?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115253/new/
https://reviews.llvm.org/D115253
More information about the cfe-commits
mailing list