bug-cvs
[Top][All Lists]
Advanced

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

stdint_.h vs MacOS X 10.4.6


From: Mark D. Baushke
Subject: stdint_.h vs MacOS X 10.4.6
Date: Mon, 03 Jul 2006 01:00:05 -0700

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Problem:

The /usr/include/stdint.h file on MacOS X, apparently needs to be
'fixed' by generation of the GNULIB stdint_.h file into stdint.h, but
includes taken later have a problem in that <sys/types.h> actually
does the #include of <stdint.h> for us. This is bad.

On MacOS X, the stdint.h file is protected using this:

#ifndef _STDINT_H_
#define _STDINT_H_

/* contents elided */

#endif

The configure tests seem to find this sufficient reason to work around
the system stdint.h file:

conftest.c:288: error: negative width in bit-field 'check_UINT8_C'
conftest.c:290: error: negative width in bit-field 'check_UINT16_C'

The first set of errors arise using these lines of <sys/_endian.h>

__BEGIN_DECLS
uint16_t        ntohs(uint16_t);
uint16_t        htons(uint16_t);
uint32_t        ntohl(uint32_t);
uint32_t        htonl(uint32_t);
__END_DECLS

the __BEGIN_DECLS is on line 91.

This patch seems to fix things for MacOS X 10.4.6

Index: stdint_.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/stdint_.h,v
retrieving revision 1.18
diff -u -p -r1.18 stdint_.h
- --- stdint_.h   3 Jul 2006 02:10:59 -0000       1.18
+++ stdint_.h   3 Jul 2006 07:53:46 -0000
@@ -35,6 +35,9 @@
 /* <sys/types.h> defines some of the stdint.h types as well, on glibc,
    IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).  */
 #if @HAVE_SYS_TYPES_H@
+#if defined __APPLE__ && @HAVE_STDINT_H@
+# include @FULL_PATH_STDINT_H@
+#endif
 # include <sys/types.h>
 #endif
 
Does this seem a reasonable patch to you?

I can provide the full config.log file on request.

There is not sys/inttypes.h file. There is an <inttypes.h> file and
it does #include <stdint.h> as required by C99.

        -- Mark

Here is the compile problem output without the above patch.

if gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../../lib -I..  -I../intl -Ino/include  
-g -O2 -MT md5.o -MD -MP -MF ".deps/md5.Tpo" -c -o md5.o ../../lib/md5.c; \
then mv -f ".deps/md5.Tpo" ".deps/md5.Po"; else rm -f ".deps/md5.Tpo"; exit 1; 
fi
In file included from /usr/include/libkern/OSByteOrder.h:52,
                 from /usr/include/sys/_endian.h:89,
                 from /usr/include/ppc/endian.h:107,
                 from /usr/include/machine/endian.h:30,
                 from /usr/include/sys/types.h:75,
                 from ./stdint.h:38,
                 from ../../lib/md5.h:25,
                 from ../../lib/md5.c:27:
/usr/include/libkern/ppc/OSByteOrder.h:42: error: parse error before 
'OSReadSwapInt16'
/usr/include/libkern/ppc/OSByteOrder.h: In function 'OSReadSwapInt16':
/usr/include/libkern/ppc/OSByteOrder.h:47: error: 'uint16_t' undeclared (first 
use in this function)
/usr/include/libkern/ppc/OSByteOrder.h:47: error: (Each undeclared identifier 
is reported only once
/usr/include/libkern/ppc/OSByteOrder.h:47: error: for each function it appears 
in.)
/usr/include/libkern/ppc/OSByteOrder.h:47: error: parse error before 'result'
/usr/include/libkern/ppc/OSByteOrder.h:48: error: nested functions are not on 
MacOSX
/usr/include/libkern/ppc/OSByteOrder.h:48: error: syntax error before '*' token
/usr/include/libkern/ppc/OSByteOrder.h:51: error: 'result' undeclared (first 
use in this function)
/usr/include/libkern/ppc/OSByteOrder.h:52: error: 'addr' undeclared (first use 
in this function)
/usr/include/libkern/ppc/OSByteOrder.h:50: error: invalid lvalue in asm output 0
/usr/include/libkern/ppc/OSByteOrder.h:50: error: memory input 3 is not 
directly addressable
/usr/include/libkern/ppc/OSByteOrder.h: At top level:
/usr/include/libkern/ppc/OSByteOrder.h:58: error: parse error before 
'OSReadSwapInt32'
/usr/include/libkern/ppc/OSByteOrder.h: In function 'OSReadSwapInt32':
/usr/include/libkern/ppc/OSByteOrder.h:63: error: 'uint32_t' undeclared (first 
use in this function)
/usr/include/libkern/ppc/OSByteOrder.h:63: error: parse error before 'result'
/usr/include/libkern/ppc/OSByteOrder.h:64: error: nested functions are not on 
MacOSX
/usr/include/libkern/ppc/OSByteOrder.h:64: error: syntax error before '*' token
/usr/include/libkern/ppc/OSByteOrder.h:67: error: 'result' undeclared (first 
use in this function)
/usr/include/libkern/ppc/OSByteOrder.h:68: error: 'addr' undeclared (first use 
in this function)
/usr/include/libkern/ppc/OSByteOrder.h:66: error: invalid lvalue in asm output 0
/usr/include/libkern/ppc/OSByteOrder.h:66: error: memory input 3 is not 
directly addressable
/usr/include/libkern/ppc/OSByteOrder.h: At top level:
/usr/include/libkern/ppc/OSByteOrder.h:74: error: parse error before 
'OSReadSwapInt64'
/usr/include/libkern/ppc/OSByteOrder.h: In function 'OSReadSwapInt64':
/usr/include/libkern/ppc/OSByteOrder.h:79: error: nested functions are not on 
MacOSX
/usr/include/libkern/ppc/OSByteOrder.h:79: error: syntax error before '*' token
/usr/include/libkern/ppc/OSByteOrder.h:81: error: parse error before 'uint64_t'
/usr/include/libkern/ppc/OSByteOrder.h:82: error: 'uint32_t' undeclared (first 
use in this function)
/usr/include/libkern/ppc/OSByteOrder.h: At top level:
/usr/include/libkern/ppc/OSByteOrder.h:87: error: parse error before ':' token
/usr/include/libkern/ppc/OSByteOrder.h:99: error: parse error before 'uint16_t'
/usr/include/libkern/ppc/OSByteOrder.h: In function 'OSWriteSwapInt16':
/usr/include/libkern/ppc/OSByteOrder.h:102: error: nested functions are not on 
MacOSX
/usr/include/libkern/ppc/OSByteOrder.h:102: error: syntax error before '*' token
/usr/include/libkern/ppc/OSByteOrder.h:105: error: 'addr' undeclared (first use 
in this function)
/usr/include/libkern/ppc/OSByteOrder.h:106: error: 'data' undeclared (first use 
in this function)
/usr/include/libkern/ppc/OSByteOrder.h:106: error: 'base' undeclared (first use 
in this function)
/usr/include/libkern/ppc/OSByteOrder.h:106: error: 'byteOffset' undeclared 
(first use in this function)
/usr/include/libkern/ppc/OSByteOrder.h:104: error: invalid lvalue in asm output 0
/usr/include/libkern/ppc/OSByteOrder.h: At top level:
/usr/include/libkern/ppc/OSByteOrder.h:114: error: parse error before 'uint32_t'
/usr/include/libkern/ppc/OSByteOrder.h: In function 'OSWriteSwapInt32':
/usr/include/libkern/ppc/OSByteOrder.h:117: error: nested functions are not on 
MacOSX
/usr/include/libkern/ppc/OSByteOrder.h:117: error: syntax error before '*' token
/usr/include/libkern/ppc/OSByteOrder.h:120: error: 'addr' undeclared (first use 
in this function)
/usr/include/libkern/ppc/OSByteOrder.h:121: error: 'data' undeclared (first use 
in this function)
/usr/include/libkern/ppc/OSByteOrder.h:121: error: 'base' undeclared (first use 
in this function)
/usr/include/libkern/ppc/OSByteOrder.h:121: error: 'byteOffset' undeclared 
(first use in this function)
/usr/include/libkern/ppc/OSByteOrder.h:119: error: invalid lvalue in asm output 0
/usr/include/libkern/ppc/OSByteOrder.h: At top level:
/usr/include/libkern/ppc/OSByteOrder.h:129: error: parse error before 'uint64_t'
/usr/include/libkern/ppc/OSByteOrder.h: In function 'OSWriteSwapInt64':
/usr/include/libkern/ppc/OSByteOrder.h:132: error: nested functions are not on 
MacOSX
/usr/include/libkern/ppc/OSByteOrder.h:132: error: syntax error before '*' token
/usr/include/libkern/ppc/OSByteOrder.h:133: error: 'uint32_t' undeclared (first 
use in this function)
/usr/include/libkern/ppc/OSByteOrder.h:138: error: 'addr' undeclared (first use 
in this function)
/usr/include/libkern/ppc/OSByteOrder.h:139: error: 'lo' undeclared (first use 
in this function)
/usr/include/libkern/ppc/OSByteOrder.h:139: error: 'hi' undeclared (first use 
in this function)
/usr/include/libkern/ppc/OSByteOrder.h:139: error: 'base' undeclared (first use 
in this function)
/usr/include/libkern/ppc/OSByteOrder.h:139: error: 'byteOffset' undeclared 
(first use in this function)
/usr/include/libkern/ppc/OSByteOrder.h:136: error: invalid lvalue in asm output 0
/usr/include/libkern/ppc/OSByteOrder.h: At top level:
/usr/include/libkern/ppc/OSByteOrder.h:146: error: parse error before 
'_OSSwapInt16'
/usr/include/libkern/ppc/OSByteOrder.h:147: error: parse error before 'data'
/usr/include/libkern/ppc/OSByteOrder.h: In function '_OSSwapInt16':
/usr/include/libkern/ppc/OSByteOrder.h:150: error: 'data' undeclared (first use 
in this function)
/usr/include/libkern/ppc/OSByteOrder.h: At top level:
/usr/include/libkern/ppc/OSByteOrder.h:155: error: parse error before 
'_OSSwapInt32'
/usr/include/libkern/ppc/OSByteOrder.h:156: error: parse error before 'data'
/usr/include/libkern/ppc/OSByteOrder.h: In function '_OSSwapInt32':
/usr/include/libkern/ppc/OSByteOrder.h:159: error: 'data' undeclared (first use 
in this function)
/usr/include/libkern/ppc/OSByteOrder.h: At top level:
/usr/include/libkern/ppc/OSByteOrder.h:164: error: parse error before 
'_OSSwapInt64'
/usr/include/libkern/ppc/OSByteOrder.h:165: error: parse error before 'data'
/usr/include/libkern/ppc/OSByteOrder.h: In function '_OSSwapInt64':
/usr/include/libkern/ppc/OSByteOrder.h:168: error: 'data' undeclared (first use 
in this function)
In file included from /usr/include/sys/_endian.h:89,
                 from /usr/include/ppc/endian.h:107,
                 from /usr/include/machine/endian.h:30,
                 from /usr/include/sys/types.h:75,
                 from ./stdint.h:38,
                 from ../../lib/md5.h:25,
                 from ../../lib/md5.c:27:
/usr/include/libkern/OSByteOrder.h: At top level:
/usr/include/libkern/OSByteOrder.h:111: error: parse error before '_OSReadInt16'
/usr/include/libkern/OSByteOrder.h: In function '_OSReadInt16':
/usr/include/libkern/OSByteOrder.h:116: error: parse error before 'uint16_t'
/usr/include/libkern/OSByteOrder.h: At top level:
/usr/include/libkern/OSByteOrder.h:121: error: parse error before '_OSReadInt32'
/usr/include/libkern/OSByteOrder.h: In function '_OSReadInt32':
/usr/include/libkern/OSByteOrder.h:126: error: parse error before 'uint32_t'
/usr/include/libkern/OSByteOrder.h: At top level:
/usr/include/libkern/OSByteOrder.h:131: error: parse error before '_OSReadInt64'
/usr/include/libkern/OSByteOrder.h: In function '_OSReadInt64':
/usr/include/libkern/OSByteOrder.h:136: error: parse error before 'uint64_t'
/usr/include/libkern/OSByteOrder.h: At top level:
/usr/include/libkern/OSByteOrder.h:146: error: parse error before 'uint16_t'
/usr/include/libkern/OSByteOrder.h: In function '_OSWriteInt16':
/usr/include/libkern/OSByteOrder.h:149: error: parse error before 'uint16_t'
/usr/include/libkern/OSByteOrder.h:149: error: 'base' undeclared (first use in 
this function)
/usr/include/libkern/OSByteOrder.h:149: error: 'byteOffset' undeclared (first 
use in this function)
/usr/include/libkern/OSByteOrder.h:149: error: 'data' undeclared (first use in 
this function)
/usr/include/libkern/OSByteOrder.h: At top level:
/usr/include/libkern/OSByteOrder.h:157: error: parse error before 'uint32_t'
/usr/include/libkern/OSByteOrder.h: In function '_OSWriteInt32':
/usr/include/libkern/OSByteOrder.h:160: error: parse error before 'uint32_t'
/usr/include/libkern/OSByteOrder.h:160: error: 'base' undeclared (first use in 
this function)
/usr/include/libkern/OSByteOrder.h:160: error: 'byteOffset' undeclared (first 
use in this function)
/usr/include/libkern/OSByteOrder.h:160: error: 'data' undeclared (first use in 
this function)
/usr/include/libkern/OSByteOrder.h: At top level:
/usr/include/libkern/OSByteOrder.h:168: error: parse error before 'uint64_t'
/usr/include/libkern/OSByteOrder.h: In function '_OSWriteInt64':
/usr/include/libkern/OSByteOrder.h:171: error: parse error before 'uint64_t'
/usr/include/libkern/OSByteOrder.h:171: error: 'base' undeclared (first use in 
this function)
/usr/include/libkern/OSByteOrder.h:171: error: 'byteOffset' undeclared (first 
use in this function)
/usr/include/libkern/OSByteOrder.h:171: error: 'data' undeclared (first use in 
this function)
In file included from /usr/include/ppc/endian.h:107,
                 from /usr/include/machine/endian.h:30,
                 from /usr/include/sys/types.h:75,
                 from ./stdint.h:38,
                 from ../../lib/md5.h:25,
                 from ../../lib/md5.c:27:
/usr/include/sys/_endian.h: At top level:
/usr/include/sys/_endian.h:92: error: parse error before 'ntohs'
/usr/include/sys/_endian.h:93: error: parse error before 'htons'
/usr/include/sys/_endian.h:94: error: parse error before 'ntohl'
/usr/include/sys/_endian.h:95: error: parse error before 'htonl'
make[3]: *** [md5.o] Error 1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (FreeBSD)

iD8DBQFEqM6FCg7APGsDnFERAiP0AKC+bVyLdmRSpGJ5XOyUw6Y19F6ywgCfd4WF
9gcMgo9ZvpBr4N3cDRZr+Do=
=TVzp
-----END PGP SIGNATURE-----




reply via email to

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