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

via libc-commits libc-commits at lists.llvm.org
Wed Jan 24 14:04:15 PST 2024


Author: lntue
Date: 2024-01-24T17:04:11-05:00
New Revision: 3a92b20cb0e61bec886d07c3f7280b8b2a4b8d49

URL: https://github.com/llvm/llvm-project/commit/3a92b20cb0e61bec886d07c3f7280b8b2a4b8d49
DIFF: https://github.com/llvm/llvm-project/commit/3a92b20cb0e61bec886d07c3f7280b8b2a4b8d49.diff

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

Added: 
    

Modified: 
    libc/include/llvm-libc-macros/limits-macros.h

Removed: 
    


################################################################################
diff  --git a/libc/include/llvm-libc-macros/limits-macros.h b/libc/include/llvm-libc-macros/limits-macros.h
index fc21d1318a081b..3ccfbff7993290 100644
--- a/libc/include/llvm-libc-macros/limits-macros.h
+++ b/libc/include/llvm-libc-macros/limits-macros.h
@@ -70,7 +70,8 @@
 #elif defined(__WORDSIZE)
 #define LONG_WIDTH __WORDSIZE
 #else
-#error "Unknown WORDSIZE to define LONG_WIDTH."
+// Use sizeof(long) * CHAR_BIT as backup. This is needed for clang-13 or before.
+#define LONG_WIDTH (sizeof(long) * CHAR_BIT)
 #endif // __LONG_WIDTH__
 #endif // LONG_WIDTH
 


        


More information about the libc-commits mailing list