bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 01/11] stdint: check _INTPTR_T_DECLARED before defining intptr_t


From: KO Myung-Hun
Subject: [PATCH 01/11] stdint: check _INTPTR_T_DECLARED before defining intptr_t and uintptr_t
Date: Sat, 7 Nov 2015 11:45:46 +0900

OS/2 kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own
definitions of intptr_t and uintptr_t (which use int and unsigned)
to avoid clashes with declarations of system functions like sbrk.

* lib/stdint.in.h (intptr_t, uintptr_t): Check
_INTPTR_T_DECLARED before defining them.
---
 ChangeLog       | 10 ++++++++++
 lib/stdint.in.h | 13 +++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b0385b7..f26a5b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2015-11-07  KO Myung-Hun  <address@hidden>
+
+    stdint: check _INTPTR_T_DECLARED before defining intptr_t and uintptr_t
+    OS/2 kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own
+    definitions of intptr_t and uintptr_t (which use int and unsigned)
+    to avoid clashes with declarations of system functions like sbrk.
+
+    * lib/stdint.in.h (intptr_t, uintptr_t): Check
+    _INTPTR_T_DECLARED before defining them.
+
 2015-11-05  Paul Eggert  <address@hidden>
 
        test-timespec: fix typo in previous change
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index f46bbf3..c946a0b 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -288,12 +288,17 @@ typedef gl_uint_fast32_t gl_uint_fast16_t;
 
 /* 7.18.1.4. Integer types capable of holding object pointers */
 
-#undef intptr_t
-#undef uintptr_t
+/* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own
+   definitions of intptr_t and uintptr_t (which use int and unsigned)
+   to avoid clashes with declarations of system functions like sbrk.  */
+#ifndef _INTPTR_T_DECLARED
+# undef intptr_t
+# undef uintptr_t
 typedef long int gl_intptr_t;
 typedef unsigned long int gl_uintptr_t;
-#define intptr_t gl_intptr_t
-#define uintptr_t gl_uintptr_t
+# define intptr_t gl_intptr_t
+# define uintptr_t gl_uintptr_t
+#endif
 
 /* 7.18.1.5. Greatest-width integer types */
 
-- 
2.6.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]