bug-gnulib
[Top][All Lists]
Advanced

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

Re: bug#9141: Coreutils Compiler Warnings on OSX 10.7 (Lion)


From: Paul Eggert
Subject: Re: bug#9141: Coreutils Compiler Warnings on OSX 10.7 (Lion)
Date: Thu, 21 Jul 2011 14:53:25 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Thunderbird/3.1.11

[Adding bug-gnulib; the original bug report is <http://debbugs.gnu.org/9141>.]

On 07/21/11 02:16, Herb Wartens wrote:

> I have added a hack to get coreutils to compile cleanly on OSX.

Thanks, but we should fix this problem more cleanly.  Does the
following patch to lib/stdint.in.h solve your problem?  This fix is
already scheduled to appear in the next version of coreutils.  If it
doesn't solve your problem, what are the symptoms of failure?

--- old/lib/stdint.in.h 2011-03-13 04:32:31.000000000 -0700
+++ new/lib/stdint.in.h 2011-07-21 14:47:33.901160610 -0700
@@ -272,6 +272,12 @@ typedef unsigned long int gl_uintptr_t;
 /* Note: These types are compiler dependent. It may be unwise to use them in
    public header files. */
 
+/* If the system defines INTMAX_MAX, assume that intmax_t works, and
+   similarly for UINTMAX_MAX and uintmax_t.  This avoids problems with
+   assuming one type where another is used by the system.  */
+
+#ifndef INTMAX_MAX
+# undef INTMAX_C
 #undef intmax_t
 #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
 typedef long long int gl_intmax_t;
@@ -282,7 +288,10 @@ typedef long long int gl_intmax_t;
 typedef long int gl_intmax_t;
 # define intmax_t gl_intmax_t
 #endif
+#endif
 
+#ifndef UINTMAX_MAX
+# undef UINTMAX_C
 #undef uintmax_t
 #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
 typedef unsigned long long int gl_uintmax_t;
@@ -293,6 +302,7 @@ typedef unsigned long long int gl_uintma
 typedef unsigned long int gl_uintmax_t;
 # define uintmax_t gl_uintmax_t
 #endif
+#endif
 
 /* Verify that intmax_t and uintmax_t have the same size.  Too much code
    breaks if this is not the case.  If this check fails, the reason is likely
@@ -433,8 +443,8 @@ typedef int _verify_intmax_size[sizeof (
 
 /* 7.18.2.5. Limits of greatest-width integer types */
 
+#ifndef INTMAX_MAX
 #undef INTMAX_MIN
-#undef INTMAX_MAX
 #ifdef INT64_MAX
 # define INTMAX_MIN  INT64_MIN
 # define INTMAX_MAX  INT64_MAX
@@ -442,13 +452,15 @@ typedef int _verify_intmax_size[sizeof (
 # define INTMAX_MIN  INT32_MIN
 # define INTMAX_MAX  INT32_MAX
 #endif
+#endif
 
-#undef UINTMAX_MAX
+#ifndef UINTMAX_MAX
 #ifdef UINT64_MAX
 # define UINTMAX_MAX  UINT64_MAX
 #else
 # define UINTMAX_MAX  UINT32_MAX
 #endif
+#endif
 
 /* 7.18.3. Limits of other integer types */
 
@@ -570,7 +582,7 @@ typedef int _verify_intmax_size[sizeof (
 
 /* 7.18.4.2. Macros for greatest-width integer constants */
 
-#undef INTMAX_C
+#ifndef INTMAX_C
 #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
 # define INTMAX_C(x)   x##LL
 #elif defined GL_INT64_T
@@ -578,8 +590,9 @@ typedef int _verify_intmax_size[sizeof (
 #else
 # define INTMAX_C(x)   x##L
 #endif
+#endif
 
-#undef UINTMAX_C
+#ifndef UINTMAX_C
 #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
 # define UINTMAX_C(x)  x##ULL
 #elif defined GL_UINT64_T
@@ -587,6 +600,7 @@ typedef int _verify_intmax_size[sizeof (
 #else
 # define UINTMAX_C(x)  x##UL
 #endif
+#endif
 
 #endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
 




reply via email to

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