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

Re: GCC predefines



On Thu, Sep 12, 2002 at 09:19:30AM +0200, Martin v. Loewis wrote:
> Joel Baker <lucifer@lightbearer.com> writes:
> 
> > Next stupid question: which standard covers 'unix', so that I can make sure
> > all the pieces are met and that I'm not about to force GCC to tell a lie
> > that will come back to haunt me later...
> 
> I'm not sure why NetBSD doesn't define __unix__; it is a good idea not
> to define unix, since that is in the application's namespace, and
> should not be defined by the compiler.
> 
> The define __unix__/__unix/unix, to my knowledge, is not covered by
> any standard - it is merely a convention. POSIX systems identify
> themselves with different defines.
> 
> Notice that FreeBSD defines unix, as does NetBSD on m68k. It may be a
> mistake: what does the system compiler define?

Hmmm. It may be. From the NetBSD native toolchain compiler:

fenton@thenet:/debian/tmp$ touch foo.c 
fenton@thenet:/debian/tmp$ /usr/tools/i386--netbsdelf/bin/gcc -v -E
foo.c
Reading specs from /usr/tools/lib/gcc-lib/i386--netbsdelf/2.95.3/specs
gcc version 2.95.3 20010315 (release) (NetBSD nb3)
 /usr/tools/lib/gcc-lib/i386--netbsdelf/2.95.3/cpp0 -lang-c -v
-D__GNUC__=2 -D__GNUC_MINOR__=95 -D__NetBSD__ -D__ELF__ -D__NetBSD__
-D__ELF__ -Asystem(unix) -Asystem(NetBSD) -Acpu(i386) -Amachine(i386)
-Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ foo.c
GNU CPP version 2.95.3 20010315 (release) (NetBSD nb3) (80386, BSD
syntax)
#include "..." search starts here:
#include <...> search starts here:
 /usr/tools/lib/gcc-lib/i386--netbsdelf/2.95.3/include
 /usr/tools/lib/gcc-lib/i386--netbsdelf/2.95.3/../../../../i386--netbsdelf/include
End of search list.
The following default directories have been omitted from the search
path:
 /usr/tools/lib/gcc-lib/i386--netbsdelf/2.95.3/../../../../include/g++-3
 /usr/tools/lib/gcc-lib/i386--netbsdelf/2.95.3/../../../../i386--netbsdelf/sys-include
End of omitted list.
# 1 "foo.c"

Not sure at all why it would define 'unix' on m68k and not i386...
-- 
***************************************************************************
Joel Baker                           System Administrator - lightbearer.com
lucifer@lightbearer.com              http://users.lightbearer.com/lucifer/

Attachment: pgpLbkzVrv5li.pgp
Description: PGP signature


Reply to: