This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libmudflap/mf-hooks2.c portability breakage


Gerald Pfeifer <gerald@pfeifer.com> writes:

> 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. :-(

Just one datapoint:

If you define _GNU_SOURCE on a glibc system, you do not need any of
the other defines.

Andreas
-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]