Dear list,

we came across a problem that might be very specific to our own setup and how 
we use the lib. We still wanted to share the
patch if there is general interest. 

Recent Clang versions (Starting from 20) have the __INT64_C and __UINT64_C 
macros built-in. The compiler does not warn
about this normally because <stdint.h> is a system header. In special cases 
where stdint.h may be included as normal header
(which is the case for our system) it does warn however. Avoid re-defining if a 
definition already exists.

The change would not impact users that use stdint.h exclusively as system 
header.

Best regards,

- Marcus

-- 
+++++++++++++++++++


Register now for our workshop "Get to know L4Re in 3 days" on April 8-10. Learn 
to design and deploy secure system
architectures for your product with L4Re: 
https://www.kernkonzept.com/workshop-getting-started-with-l4re/

+++++++++++++++++++

Kernkonzept GmbH
Sitz: Dresden
HRB 31129
Geschäftsführer: Dr.-Ing. Michael Hohmuth


From d0b55797a9c2903791a151c50d9aa741661d8d61 Mon Sep 17 00:00:00 2001
From: Frank Mehnert <[email protected]>
Date: Wed, 5 Mar 2025 15:26:34 +0100
Subject: [PATCH] stdint.h: don't define __INT64_C / __UINT64_C if already
 defined

Recent Clang versions (Starting from 20) have this macro built-in. The
compiler does not warn about this normally because <stdint.h> is a
system header. In special cases where stdint.h may be included as normal
header it does warn however. Avoid re-defining if a definition already
exists.

Signed-off-by: Marcus Haehnel <[email protected]>
---
 include/stdint.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/stdint.h b/include/stdint.h
index 749f73697..5fedfb574 100644
--- a/include/stdint.h
+++ b/include/stdint.h
@@ -144,11 +144,19 @@ typedef unsigned long long int	uintmax_t;
 
 
 # if __WORDSIZE == 64
+#  ifndef __INT64_C
 #  define __INT64_C(c)	c ## L
+#  endif
+#  ifndef __UINT64_C
 #  define __UINT64_C(c)	c ## UL
+#  endif
 # else
+#  ifndef __INT64_C
 #  define __INT64_C(c)	c ## LL
+#  endif
+#  ifndef __UINT64_C
 #  define __UINT64_C(c)	c ## ULL
+#  endif
 # endif
 
 /* Limits of integral types.  */
-- 
2.47.1

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to