This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
libmudflap/mf-hooks2.c portability breakage
- From: Gerald Pfeifer <gerald at pfeifer dot com>
- To: gcc at gcc dot gnu dot org
- Cc: "Frank Ch. Eigler" <fche at redhat dot com>
- Date: Tue, 29 Jul 2003 14:38:59 +0200 (CEST)
- Subject: libmudflap/mf-hooks2.c portability breakage
FreeBSD fails to bootstrap tree-ssa branch, because libmudflap/mf-hooks2.c
contains
/* These attempt to coax various unix flavours to declare all our
needed tidbits in the system headers. */
#define _POSIX_SOURCE <<---
#define _GNU_SOURCE
#define _XOPEN_SOURCE
#define _BSD_TYPES
#define __EXTENSIONS__
and afterwards includes <sys/types.h>, which on FreeBSD 4.8 has the
following
#ifndef _POSIX_SOURCE
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef unsigned short ushort; /* Sys V compatibility */
typedef unsigned int uint; /* Sys V compatibility */
#endif
so, in the end, the following part of <sys/socket.h> which is included a
bit fails to compile (as u_char is undefined):
typedef u_char sa_family_t;
Defining _POSIX_SOURCE breaks compilation on FreeBSD. The question is:
which systems really does need it? Unfortunately, there is not comment
explaining that. :-(
Gerald
PS: The patch below is a workaround on FreeBSD, though I suppose other
systems will still remain broken.
Index: mf-hooks2.c
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-hooks2.c,v
retrieving revision 1.1.2.1
diff -u -3 -p -r1.1.2.1 mf-hooks2.c
--- mf-hooks2.c 4 Jul 2003 23:10:09 -0000 1.1.2.1
+++ mf-hooks2.c 29 Jul 2003 12:35:50 -0000
@@ -11,7 +11,9 @@ XXX: libgcc license?
/* These attempt to coax various unix flavours to declare all our
needed tidbits in the system headers. */
+#ifndef __FreeBSD__
#define _POSIX_SOURCE
+#endif
#define _GNU_SOURCE
#define _XOPEN_SOURCE
#define _BSD_TYPES