[libc-commits] [libc] [libc] Add backup definition for LONG_WIDTH in limits-macros.h. (PR #79375)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Wed Jan 24 13:53:46 PST 2024


================
@@ -69,8 +69,8 @@
 #define LONG_WIDTH __LONG_WIDTH__
 #elif defined(__WORDSIZE)
 #define LONG_WIDTH __WORDSIZE
-#else
-#error "Unknown WORDSIZE to define LONG_WIDTH."
+#else // use sizeof(long) * CHAR_BIT as backup.
+#define LONG_WIDTH (sizeof(long) * CHAR_BIT)
----------------
nickdesaulniers wrote:

clang-14 is the first release to define `__LONG_WIDTH__`.

https://github.com/llvm/llvm-project/pull/79375


More information about the libc-commits mailing list