This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Define __gnu_linux__ and __gnu_hurd__
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 13 Apr 2002 17:55:08 -0400
- Subject: Re: PATCH: Define __gnu_linux__ and __gnu_hurd__
- References: <6210000.1018725865@warlock.codesourcery.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Sat, Apr 13, 2002 at 12:24:25PM -0700, Mark Mitchell wrote:
> *** alpha/linux.h 12 Dec 2001 06:40:27 -0000 1.25
> --- alpha/linux.h 13 Apr 2002 19:07:59 -0000
> ***************
> *** 1,6 ****
> /* Definitions of target machine for GNU compiler,
> for Alpha Linux-based GNU systems.
> ! Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
> Contributed by Richard Henderson.
>
> This file is part of GNU CC.
> --- 1,6 ----
> /* Definitions of target machine for GNU compiler,
> for Alpha Linux-based GNU systems.
> ! Copyright (C) 1996, 1997, 1998, 2002 Free Software Foundation, Inc.
> Contributed by Richard Henderson.
>
> This file is part of GNU CC.
> *************** Boston, MA 02111-1307, USA. */
> *** 25,31 ****
>
> #undef CPP_PREDEFINES
> #define CPP_PREDEFINES \
> ! "-Dlinux -Dunix -Asystem=linux -D_LONGLONG -D__alpha__ " \
> SUB_CPP_PREDEFINES
>
> /* The GNU C++ standard library requires that these macros be defined. */
> --- 25,31 ----
>
> #undef CPP_PREDEFINES
> #define CPP_PREDEFINES \
> ! "-Dgnu_linux Dlinux -Dunix -Asystem=linux -D_LONGLONG -D__alpha__ " \
Typo:
^ missing -
> Index: i386/gnu.h
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/config/i386/gnu.h,v
> retrieving revision 1.12
> diff -c -p -r1.12 gnu.h
> *** i386/gnu.h 15 Dec 2001 11:46:49 -0000 1.12
> --- i386/gnu.h 13 Apr 2002 19:07:59 -0000
> ***************
> *** 5,11 ****
>
> #undef CPP_PREDEFINES
> #define CPP_PREDEFINES "-D__ELF__ -DMACH -Asystem=mach \
> ! -Dunix -Asystem=unix -Asystem=posix -D__GNU__ -Asystem=gnu"
>
> #undef CPP_SPEC
> #define CPP_SPEC "%(cpp_cpu) \
> --- 5,11 ----
>
> #undef CPP_PREDEFINES
> #define CPP_PREDEFINES "-D__ELF__ -DMACH -Asystem=mach \
> ! -Dunix -Asystem=unix -Asystem=posix -Dgnu_hurd -D__GNU__ -Asystem=gnu"
Shouldn't at least this be really -D__gnu_hurd__?
Here __GNU__ is not violating namespace but gnu_hurd would be.
(plus IMHO s/-Dgnu_linux/-D__gnu_linux__/ really should be done globally,
we shouldn't be poluting namespace because of this any more than it is now).
/FLAME ON/
I bet no one will use #ifdef __gnu_linux__ anyway, since it means the code
won't be portable to gcc <= 3.0.x and writing
#if defined __gnu_linux__ || defined __linux__
is way longer than #ifdef __linux__; if the test is meant for GNU C
library systems, one writes #ifdef __GLIBC__ and the preferred way is
autoconf...
/FLAME OFF/
Jakub