Florent Revest
2025-Jul-14 17:25 UTC
[klibc] [PATCH v2] stdint.h: Fix build with newer clang
Recent versions of Clang introduced definitions for __*INT64_C: https://github.com/llvm/llvm-project/commit/33ad474c45e6d7a0de7bc75e15e27cf6cb9ff895 This results in these build 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 | ^ Renaming these macros to something more unique avoids the errors. Signed-off-by: Florent Revest <revest at chromium.org> --- usr/include/bits32/bitsize/stdint.h | 4 ++-- usr/include/bits64/bitsize/stdint.h | 4 ++-- usr/include/stdint.h | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/usr/include/bits32/bitsize/stdint.h b/usr/include/bits32/bitsize/stdint.h index 8e444b6d..147090b8 100644 --- a/usr/include/bits32/bitsize/stdint.h +++ b/usr/include/bits32/bitsize/stdint.h @@ -24,8 +24,8 @@ typedef unsigned int uint_fast32_t; typedef int intptr_t; typedef unsigned int uintptr_t; -#define __INT64_C(c) c ## LL -#define __UINT64_C(c) c ## ULL +#define __KLIBC_INT64_C(c) c ## LL +#define __KLIBC_UINT64_C(c) c ## ULL #define __PRI64_RANK "ll" #define __PRIFAST_RANK "" diff --git a/usr/include/bits64/bitsize/stdint.h b/usr/include/bits64/bitsize/stdint.h index 988e6396..5bc64bf6 100644 --- a/usr/include/bits64/bitsize/stdint.h +++ b/usr/include/bits64/bitsize/stdint.h @@ -24,8 +24,8 @@ typedef unsigned long int uint_fast32_t; typedef long int intptr_t; typedef unsigned long int uintptr_t; -#define __INT64_C(c) c ## L -#define __UINT64_C(c) c ## UL +#define __KLIBC_INT64_C(c) c ## L +#define __KLIBC_UINT64_C(c) c ## UL #define __PRI64_RANK "l" #define __PRIFAST_RANK "l" diff --git a/usr/include/stdint.h b/usr/include/stdint.h index f64f0278..6cda583c 100644 --- a/usr/include/stdint.h +++ b/usr/include/stdint.h @@ -31,17 +31,17 @@ typedef uint64_t uintmax_t; #define INT8_MIN (-128) #define INT16_MIN (-32768) #define INT32_MIN (-2147483647-1) -#define INT64_MIN (__INT64_C(-9223372036854775807)-1) +#define INT64_MIN (__KLIBC_INT64_C(-9223372036854775807)-1) #define INT8_MAX (127) #define INT16_MAX (32767) #define INT32_MAX (2147483647) -#define INT64_MAX (__INT64_C(9223372036854775807)) +#define INT64_MAX (__KLIBC_INT64_C(9223372036854775807)) #define UINT8_MAX (255U) #define UINT16_MAX (65535U) #define UINT32_MAX (4294967295U) -#define UINT64_MAX (__UINT64_C(18446744073709551615)) +#define UINT64_MAX (__KLIBC_UINT64_C(18446744073709551615)) #define INT_LEAST8_MIN INT8_MIN #define INT_LEAST16_MIN INT16_MIN @@ -80,12 +80,12 @@ typedef uint64_t uintmax_t; #define INT8_C(c) c #define INT16_C(c) c #define INT32_C(c) c -#define INT64_C(c) __INT64_C(c) +#define INT64_C(c) __KLIBC_INT64_C(c) #define UINT8_C(c) c ## U #define UINT16_C(c) c ## U #define UINT32_C(c) c ## U -#define UINT64_C(c) __UINT64_C(c) +#define UINT64_C(c) __KLIBC_UINT64_C(c) #define INT_LEAST8_C(c) INT8_C(c) #define INT_LEAST16_C(c) INT16_C(c) -- 2.50.0.727.gbf7dc18ff4-goog
H. Peter Anvin
2025-Jul-18 21:44 UTC
[klibc] [PATCH v2] stdint.h: Fix build with newer clang
On 2025-07-14 10:25, Florent Revest wrote:> Recent versions of Clang introduced definitions for __*INT64_C: > https://github.com/llvm/llvm-project/commit/33ad474c45e6d7a0de7bc75e15e27cf6cb9ff895 > > This results in these build 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 > | ^ >Arguably we should use <stdint.h> from the compiler. I suspect that all the compilers we care about now provide it as an internal header. -hpa
Ben Hutchings
2025-Jul-27 16:11 UTC
[klibc] [PATCH v2] stdint.h: Fix build with newer clang
On Mon, 2025-07-14 at 19:25 +0200, Florent Revest wrote:> Recent versions of Clang introduced definitions for __*INT64_C: > https://github.com/llvm/llvm-project/commit/33ad474c45e6d7a0de7bc75e15e27cf6cb9ff895 > > This results in these build 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 > | ^ > > Renaming these macros to something more unique avoids the errors. > > Signed-off-by: Florent Revest <revest at chromium.org>[...] Applied, thanks. Ben. -- Ben Hutchings The Peter principle: In a hierarchy, every employee tends to rise to their level of incompetence. -------------- 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/20250727/91a22846/attachment.sig>