bug-cvs
[Top][All Lists]
Advanced

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

Re: stdint module on SGI


From: Mark D. Baushke
Subject: Re: stdint module on SGI
Date: Mon, 26 Jun 2006 08:57:25 -0700

Bruno Haible <address@hidden> writes:

> Mark D. Baushke wrote:
> > In fact, the SGI
> > IRIX 5.3 c99 compiler does have <inttypes.h> do
> > this. When c89 is used, the file is not included,
> > but all of the needed types are defined.
> 
> Let me try to recap it. Do these comments reflect the reality?
> 
> Bruno
> 
> 
> *** lib/stdint_.h       26 Jun 2006 13:06:51 -0000      1.20
> --- lib/stdint_.h       26 Jun 2006 13:25:35 -0000
> ***************
> *** 67,73 ****
>   #endif
>   #if @HAVE_STDINT_H@
>     /* Other systems may have an incomplete <stdint.h>.  */
> ! # include @FULL_PATH_STDINT_H@
>   #endif
>   
>   /* 7.18.1.1. Exact-width integer types */
> --- 67,81 ----
>   #endif
>   #if @HAVE_STDINT_H@
>     /* Other systems may have an incomplete <stdint.h>.  */
> !   /* On some versions of IRIX, the SGI C compiler comes with an <stdint.h>,
> !      but
> !        - in c99 mode, <inttypes.h> includes <stdint.h>,

Yes. I am told that /usr/include/stdint.h has the following:

#ifndef __c99
#error This header file is to be used only for c99 mode compilations
#else

#endif

The #else clause contains the typedefs one normally assumes are in
<stdint.h>.

The <inttypes.h> file similarly does this:

#if !(defined(__c99))
/* ... all of the c89 typedefs go here */
#else

#include <stdint.h>
#include <wchar.h>
/* ... all of the rest of the c99 stuff for <inttypes.h> goes here */
#endif /* __c99 */

> !        - in c89 mode, <stdint.h> spews warnings and <inttypes.h> too
> !          defines all types and macros that are defined in <stdint.h>.
> !      So we rely only on <inttypes.h> (included above).  */

Yes, the #error in c89 mode is considered a warning under normal
circumstances.

> ! # if !(defined(__sgi) && @HAVE_INTTYPES_H@)
> ! #  include @FULL_PATH_STDINT_H@
> ! # endif
>   #endif
>   
>   /* 7.18.1.1. Exact-width integer types */


I suppose an alternative would be

#if @HAVE_STDINT_H@
# if (!defined(__sgi) || defined(__c99)) && @HAVE_INTTYPES_H@
#  include @FULL_PATH_STDINT_H
# endif
#endif

which should do the right thing even when the users 
uses 'CC=c99 configure' ... the patch below updates
my copy of the gnulib files, but has not been tested
on an SGI box as yet.

Note: we would also still need to have this
near the top of the generated <stdint.h> file.

#if !defined(WCHAR_MIN) && defined(HAVE_WCHAR_H)
# include <wchar.h>
#endif

To handle <stddef.h> files that are missing <wchar.h> stuff which I
believe wasw a problem under BSD/OS.

        -- Mark

2006-06-26  Mark D. Baushke  <address@hidden>

        * stdint_.h: Use the SGI __c99 symbol to determine if the odd
        #error in <stdint.h> needs to be avoided in c89 mode.

2006-06-23  Larry Jones  <address@hidden>

        * stdint_.h: Try harder to find a definition of WCHAR_MIN/MAX.

Index: lib/stdint_.h
===================================================================
RCS file: /sources/gnulib/gnulib/lib/stdint_.h,v
retrieving revision 1.20
diff -u -p -r1.20 stdint_.h
--- lib/stdint_.h       26 Jun 2006 13:06:51 -0000      1.20
+++ lib/stdint_.h       26 Jun 2006 15:51:18 -0000
@@ -26,6 +26,9 @@
 
 /* Get wchar_t, WCHAR_MIN, WCHAR_MAX.  */
 #include <stddef.h>
+#if !defined(WCHAR_MIN) && defined(HAVE_WCHAR_H)
+# include <wchar.h>
+#endif
 /* Get LONG_MIN, LONG_MAX, ULONG_MAX.  */
 #include <limits.h>
 
@@ -67,7 +70,9 @@
 #endif
 #if @HAVE_STDINT_H@
   /* Other systems may have an incomplete <stdint.h>.  */
-# include @FULL_PATH_STDINT_H@
+# if (!defined(__sgi) || defined(__c99)) && @HAVE_INTTYPES_H@
+#  include @FULL_PATH_STDINT_H@
+# endif
 #endif
 
 /* 7.18.1.1. Exact-width integer types */
Index: m4/stdint.m4
===================================================================
RCS file: /sources/gnulib/gnulib/m4/stdint.m4,v
retrieving revision 1.9
diff -u -p -r1.9 stdint.m4
--- m4/stdint.m4        26 Jun 2006 13:06:51 -0000      1.9
+++ m4/stdint.m4        26 Jun 2006 15:51:19 -0000
@@ -106,7 +106,9 @@ typedef int array [2 * (POW63 != 0 && PO
 # include FULL_PATH_INTTYPES_H
 #endif
 #if HAVE_STDINT_H
-# include FULL_PATH_STDINT_H
+# if (!defined(__sgi) || defined(__c99)) && HAVE_INTTYPES_H
+#  include FULL_PATH_STDINT_H
+# endif
 #endif
 '
   gl_STDINT_CHECK_TYPES(




reply via email to

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