This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/38182] stddef.h assumes machinee/ansi.h defines _ANSI_H_
- From: "prlw1 at cam dot ac dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Mar 2009 20:45:10 -0000
- Subject: [Bug target/38182] stddef.h assumes machinee/ansi.h defines _ANSI_H_
- References: <bug-38182-15541@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from prlw1 at cam dot ac dot uk 2009-03-23 20:45 -------
(In reply to comment #5)
> The patch is obviously wrong (it changes the installed headers for all
> targets instead of setting USER_H to adjust the list for the target with
> this issue)
Care to explain more re USER_H? I tried to addIndex: stddef.h
===================================================================
--- stddef.h (revision 145011)
+++ stddef.h (working copy)
@@ -62,6 +62,20 @@
#include <sys/_types.h>
#endif
+#if defined(__NetBSD__)
+typedef _BSD_PTRDIFF_T_ ptrdiff_t;
+
+#ifdef _BSD_SIZE_T_
+typedef _BSD_SIZE_T_ size_t;
+#undef _BSD_SIZE_T_
+#endif
+
+#ifdef _BSD_WCHAR_T_
+typedef _BSD_WCHAR_T_ wchar_t;
+#undef _BSD_WCHAR_T_
+#endif
+#endif /* __NetBSD__ */
+
/* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
defined if the corresponding type is *not* defined.
FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */
which allowed me to compile gfortran. libsup++ failed including time.h, which
behaved as though _BSD_SIZE_T_ was defined, but empty.
Simply put, if I gcc -E gcc/gcc/ginclude/stddef.h, size_t is not defined:
# 1 "stddef.h"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "stddef.h"
# 58 "stddef.h"
# 1 "/usr/include/machine/ansi.h" 1 3 4
# 37 "/usr/include/machine/ansi.h" 3 4
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 59 "/usr/include/sys/cdefs.h" 3 4
# 1 "/usr/include/machine/cdefs.h" 1 3 4
# 60 "/usr/include/sys/cdefs.h" 2 3 4
# 1 "/usr/include/sys/cdefs_elf.h" 1 3 4
# 62 "/usr/include/sys/cdefs.h" 2 3 4
# 38 "/usr/include/machine/ansi.h" 2 3 4
# 1 "/usr/include/machine/int_types.h" 1 3 4
# 45 "/usr/include/machine/int_types.h" 3 4
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short int __int16_t;
typedef unsigned short int __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
typedef long long int __int64_t;
typedef unsigned long long int __uint64_t;
typedef int __intptr_t;
typedef unsigned int __uintptr_t;
# 40 "/usr/include/machine/ansi.h" 2 3 4
# 73 "/usr/include/machine/ansi.h" 3 4
typedef union {
__int64_t __mbstateL;
char __mbstate8[128];
} __mbstate_t;
# 59 "stddef.h" 2
and machine/ansi.h defines _${MACHINE}_ANSI_H_ on NetBSD. If I gcc -E
/usr/include/stddef.h, size_t is defined.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38182