Subject: lib/30072: Non-ANSI system header
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <neil@daikokuya.co.uk>
List: netbsd-bugs
Date: 04/27/2005 13:24:00
>Number:         30072
>Category:       lib
>Synopsis:       Non-ANSI system header <stdio.h>
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 27 13:24:00 +0000 2005
>Originator:     neil@daikokuya.co.uk
>Release:        NetBSD 3.99.3
>Organization:
>Environment:
System: NetBSD duron.akihabara.co.uk 3.99.3 NetBSD 3.99.3 (GENERIC) #0: Sun Apr 24 19:25:18 JST 2005 root@duron.akihabara.co.uk:/usr/obj/usr/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
#include <stdio.h>

on x86 gives the following trace with GCC's preprocessed output:

# 1 "main.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "main.c"
# 10 "main.c"
# 1 "/usr/include/stdio.h" 1 3 4
# 40 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/sys/ansi.h" 1 3 4
# 42 "/usr/include/sys/ansi.h" 3 4
# 1 "/usr/include/machine/int_types.h" 1 3 4
# 43 "/usr/include/machine/int_types.h" 3 4
typedef __signed char __int8_t;

Note the unprotected use of __signed.

>How-To-Repeat:
  cpp -E the one-liner above.
>Fix:
  Maybe include cdefs.h earlier in stdio.h.

Just a comment:

I'm writing an ANSI C front end; that's how I found this.  NetBSD's
system headers are not nice to non-GCC compilers; almost none will compile
because of the

 #error Function renaming non possible

line.  It would be nice to give others a cop-out, even if it were
to define __RENAME() to nothing (and leaving errors to link-time?).
As it is, I have to mess with system headers to develop an alternative
compiler.