bug-gnulib
[Top][All Lists]
Advanced

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

Re: gnulib subverts system typedef for intptr_t


From: Bruno Haible
Subject: Re: gnulib subverts system typedef for intptr_t
Date: Mon, 18 Nov 2019 14:01:34 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-166-generic; KDE/5.18.0; x86_64; ; )

Hi Keith,

Keith Marshall wrote on 2019-10-15:
> I ran into this, when cross-compiling GNU gettext-0.20.1 for a mingw32
> host; you may find details at
> 
>    https://osdn.net/projects/mingw/ticket/39677
> 
> While I can work around the compilation failure, (and the workaround
> likely makes the MinGW.org headers more robust), I thought you may like
> to know of the underlying issue.

Thanks. Since mingw defines intptr_t and uintptr_t in a central place
(<crtdefs.h>), it makes sense to avoid redefining these types.


2019-11-18  Bruno Haible  <address@hidden>

        stdint: Avoid triggering a "conflicting types" error on mingw 5.22.
        Reported by Keith Marshall <address@hidden> 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>.

diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index 6fa7a23..733fcb3 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -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;




reply via email to

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