[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
<stdint.h> on IRIX-5.3 & SGI-cc
From: |
Martin Neitzel |
Subject: |
<stdint.h> on IRIX-5.3 & SGI-cc |
Date: |
Fri, 23 Jun 2006 05:22:43 +0200 (CEST) |
I'm not sure whether I should really chime in.
I'm mostly sending this stuff just because "What required for SGIs?"
w.r.t. stdint/inttypes has become a current topic and this fits in.
The recent gnulib stdint_.h changes for SGIs look promising to me.
However, it'll take some days for me to check them out. It's probably
silly but I just compiled these notes in the last days, so maybe I
should send them out now just as well. (Perhaps it serves as input
of some kind to someone, and IRIX-5.3 Indigos aren't exactly top-selling
machines these days...)
In March, I had major trouble to compile lib/md5.c, originating in
problems with stdint.h / inttypes.h. I was able to get it compile
cleanly in early April. (I also had to make three other, unrelated
fixes to te CVS sources.) I am confident that my setup gives the
definitions which I need but due to my lack of understanding of the
entire gnulib & autoconf architecture, I was not able to decide which
would be the clean tweaks. Then again, my (dirty!) tweaks turned out
to be just two little ones. I don't know how relevant to the current
discussion this still is. [Again: looks like the new "defined(__sgi)"
stuff just takes care of it, and in a proper way, too.]
This is CVS on a SGI Indigo (R3000, 32bit) running IRIX-5.3 and SGI's
commercial "IRIX Developer Option" cc (ANSI C as in ISO :1990 or
c89). I'm using -w2 which turns all warnings into serious errors
requiring some treatment (just like gcc -Werror does).
On this platform, the following SGI system headers exist:
<sys/types.h>: typedefs int{8,16,32}_t
<inttypes.h>: typedefs int{8,16,32,64}_t & unsigned counterparts
These two headerfiles are mutually exclusive. The comments in config.h
indicate this possible clash, and the autoconfiguration #defines neither
HAVE_INTTYPES_H nor HAVE_INTTYPES_H_WITH_UINTMAX (correctly, according
to the comments).
There is no <stdint.h> on this platform.
My adjustments to get md5.c to compile were these:
(a) make the (generated) lib/stdint.h supply the missing "int64_t" and
all uintXX_t typedefs, but rely on int{8,16,32}_t coming from
SGI's <sys/types.h>.
(b) reorder the includes in md5.c so that SGI's <sys/types.h>
is included before md5.h indirectly includes the (generated)
gnulib-stdint.h (the latter really depends on <sys/types.h>).
I append the (simple) diffs for (a) and (b) with following caveats:
(1) I _know_ my "_STDINT_H_NEED_SIGNED_INT_TYPES_XXX" renaming to achieve
purpose (a) above is a crude hack. (That's why it's "XXX".) My
only excuse is that I'm definitely too uninformed about both the
C standards and the gnulib/autoconf way of life to make any clever
decision about the placement/formulation of a proper fix.
(2) In the meantime, lib/stdint_.h has changed *a lot*, anyway.
[Like the new __sgi-dependent code I just see now.]
Having said this, it did the job. Maybe it serves as a tiny assist
to find the Right Thing for SGIs. I also have IRIX-6.5 R4400 + R10K
Indigo2s, but "only" with gcc, not the SGI compiler. I'm currently
extremely busy but if you think you can need more input, let me know.
Martin
Index: md5.c
===================================================================
RCS file: /sources/cvs/ccvs/lib/md5.c,v
retrieving revision 1.14
diff -u -r1.14 md5.c
--- md5.c 25 Jan 2006 12:53:38 -0000 1.14
+++ md5.c 22 Jun 2006 23:41:53 -0000
@@ -24,12 +24,13 @@
# include <config.h>
#endif
+#include <sys/types.h>
+
#include "md5.h"
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/types.h>
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
Index: stdint_.h
===================================================================
RCS file: /sources/cvs/ccvs/lib/stdint_.h,v
retrieving revision 1.7
diff -u -r1.7 stdint_.h
--- stdint_.h 30 Mar 2006 18:13:12 -0000 1.7
+++ stdint_.h 23 Jun 2006 02:08:32 -0000
@@ -65,7 +65,7 @@
# define _STDINT_H_HAVE_SYSTEM_INTTYPES
#endif
#if !((defined(UNIX_CYGWIN32) || defined(__linux__)) &&
defined(__BIT_TYPES_DEFINED__))
-# define _STDINT_H_NEED_SIGNED_INT_TYPES
+# define _STDINT_H_NEED_SIGNED_INT_TYPES_XXX
#endif
#if !defined(_STDINT_H_HAVE_SYSTEM_INTTYPES)
@@ -96,7 +96,7 @@
typedef unsigned long uint64_t;
#define _STDINT_H_HAVE_INT64
#elif @HAVE_LONG_LONG_64BIT@
-#ifdef _STDINT_H_NEED_SIGNED_INT_TYPES
+#ifdef _STDINT_H_NEED_SIGNED_INT_TYPES_XXX
typedef long long int64_t;
#endif
typedef unsigned long long uint64_t;
- <stdint.h> on IRIX-5.3 & SGI-cc,
Martin Neitzel <=