Florent Revest
2025-Jul-10 17:39 UTC
[klibc] [PATCH 2/2] stdint.h: Fix build with newer clang
When building with recent versions of LLVM, I get the following errors:
usr/include/bits64/bitsize/stdint.h:27:9: error: '__INT64_C' macro
redefined [-Werror,-Wmacro-redefined]
27 | #define __INT64_C(c) c ## L
| ^
<built-in>:194:9: note: previous definition is here
194 | #define __INT64_C(c) c##L
| ^
It looks like newer versions of LLVM also define these macros.
Surrounding them with ifndef avoids errors.
Signed-off-by: Florent Revest <revest at chromium.org>
---
usr/include/bits64/bitsize/stdint.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/usr/include/bits64/bitsize/stdint.h
b/usr/include/bits64/bitsize/stdint.h
index 988e6396..a28c041e 100644
--- a/usr/include/bits64/bitsize/stdint.h
+++ b/usr/include/bits64/bitsize/stdint.h
@@ -24,8 +24,12 @@ typedef unsigned long int uint_fast32_t;
typedef long int intptr_t;
typedef unsigned long int uintptr_t;
+#ifndef __INT64_C
#define __INT64_C(c) c ## L
+#endif
+#ifndef __UINT64_C
#define __UINT64_C(c) c ## UL
+#endif
#define __PRI64_RANK "l"
#define __PRIFAST_RANK "l"
--
2.50.0.727.gbf7dc18ff4-goog
Ben Hutchings
2025-Jul-12 16:47 UTC
[klibc] [PATCH 2/2] stdint.h: Fix build with newer clang
On Thu, 2025-07-10 at 19:39 +0200, Florent Revest wrote:> When building with recent versions of LLVM, I get the following errors: > > usr/include/bits64/bitsize/stdint.h:27:9: error: '__INT64_C' macro redefined [-Werror,-Wmacro-redefined] > 27 | #define __INT64_C(c) c ## L > | ^ > <built-in>:194:9: note: previous definition is here > 194 | #define __INT64_C(c) c##L > | ^ > > It looks like newer versions of LLVM also define these macros.Where are they defined, and what are they defined as?> Surrounding them with ifndef avoids errors.When we have a naming conflict with something pre-defined by the C compiler, I think it may be better to rename our macros rather than assume the compiler's definition will match what we want.> Signed-off-by: Florent Revest <revest at chromium.org> > --- > usr/include/bits64/bitsize/stdint.h | 4 ++++ > 1 file changed, 4 insertions(+)[...] And what about 32-bit architectures? Ben. -- Ben Hutchings Experience is directly proportional to the value of equipment destroyed - Carolyn Scheppner -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: <https://lists.zytor.com/archives/klibc/attachments/20250712/85eb19f2/attachment.sig>