]> Savannah Git Hosting - gnulib.git/commitdiff
stdint: Avoid triggering a "conflicting types" error on mingw 5.22.
authorBruno Haible <bruno@clisp.org>
Mon, 18 Nov 2019 12:57:46 +0000 (13:57 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 18 Nov 2019 12:57:46 +0000 (13:57 +0100)
Reported by Keith Marshall <keith@users.osdn.me> in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-10/msg00044.html>
and <https://osdn.net/projects/mingw/ticket/39677>.

* lib/stdint.in.h (intptr_t, uintptr_t): Don't define if the types have
already been defined by mingw's <crtdefs.h>.

ChangeLog
lib/stdint.in.h

index 8f3d3a3d5f5b1ffacbe1277c7d2e12476caa13f9..69a1e98ffc38380d91a15b8423bf29a68e99b48c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2019-11-18  Bruno Haible  <bruno@clisp.org>
+
+       stdint: Avoid triggering a "conflicting types" error on mingw 5.22.
+       Reported by Keith Marshall <keith@users.osdn.me> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2019-10/msg00044.html>
+       and <https://osdn.net/projects/mingw/ticket/39677>.
+       * lib/stdint.in.h (intptr_t, uintptr_t): Don't define if the types have
+       already been defined by mingw's <crtdefs.h>.
+
 2019-11-18  Bruno Haible  <bruno@clisp.org>
 
        gnulib-tool: Fix build error on macOS with --conditional-dependencies.
index 6fa7a23a816e8d742ee5ce2bad9e5c81220e5a79..733fcb398c8c1cb02eb871598978e5db35dad94f 100644 (file)
@@ -299,10 +299,15 @@ typedef gl_uint_fast32_t gl_uint_fast16_t;
 
 /* 7.18.1.4. Integer types capable of holding object pointers */
 
-/* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own
+/* 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
+   to avoid clashes with declarations of system functions like sbrk.
+   Similarly, mingw 5.22 <crtdefs.h> defines _INTPTR_T_DEFINED and
+   _UINTPTR_T_DEFINED and needs its own definitions of intptr_t and
+   uintptr_t to avoid conflicting declarations of system functions like
+   _findclose in <io.h>.  */
+# if !((defined __KLIBC__ && defined _INTPTR_T_DECLARED) \
+       || (defined __MINGW32__ && defined _INTPTR_T_DEFINED && defined _UINTPTR_T_DEFINED))
 # undef intptr_t
 # undef uintptr_t
 typedef long int gl_intptr_t;