Subject: toolchain/22211: including sys/cdefs.h breaks with gcc 3.3's cpp
To: None <gnats-bugs@gnats.netbsd.org>
From: Martin Husemann <martin@duskware.de>
List: netbsd-bugs
Date: 07/21/2003 17:40:16
>Number:         22211
>Category:       toolchain
>Synopsis:       including sys/cdefs.h breaks with gcc 3.3's cpp
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    toolchain-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 21 15:41:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Martin Husemann
>Release:        NetBSD 1.6U
>Organization:
	
>Environment:
System: NetBSD night-porter.duskware.de 1.6U NetBSD 1.6U (PORTER) #1: Fri Jul 18 07:00:29 CEST 2003 martin@night-porter.duskware.de:/usr/src/sys/arch/i386/compile/PORTER i386
Architecture: i386
Machine: i386
>Description:

If you use gcc 3.3 and invoke cpp alone (i.e. not by gcc -E or whatever 
indirect means) there is no predefined __GNUC__ macro.

This breaks everything that includes (indirectly) <sys/cdefs.h>

The GCC doku says about this (and the __GNUC_MINOR__ and __GNUC_PATCHLEVEL__
macros): "They are defined only when the entire compiler is in use; if you
invoke the preprocessor directly, they are not defined".

IMHO this is pretty stupid, but what do I know.

This has been discussed a lot on the tech-pkg list already, but a authoritive
toolchain decision is needed here.

>How-To-Repeat:

s.a.

>Fix:
Either fix <sys/cdefs.h> not to bail if an unknown compiler is used, or change
cpp to default to the "-gcc" option.
>Release-Note:
>Audit-Trail:
>Unformatted: