Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Feb 2002 13:27:31 -0800 (PST)
From:      Thomas Pornin <pornin@bolet.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/35321: standard include files do not comply to standards
Message-ID:  <200202252127.g1PLRVU53282@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         35321
>Category:       bin
>Synopsis:       standard include files do not comply to standards
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 25 13:30:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Pornin
>Release:        4.5-PRERELEASE
>Organization:
NONE
>Environment:
FreeBSD nostromo.bolet.org 4.5-PRERELEASE FreeBSD 4.5-PRERELEASE #0: Sat Dec 22 09:18:15 CET 2001 root@nostromo.bolet.org:/usr/src/sys/compile/NOSTROMO  i386

>Description:
/usr/include/machine/ansi.h contains the following line:

typedef __signed char              __int8_t;

The `__signed' is recognized by gcc as an alternate name for `signed'
but is not standard. /usr/include/sys/cdefs.h contains some macros
that map `__signed' to `signed' or nothing depending on the value of
__STDC__. But some include files include <machine/ansi.h> and not
<sys/cdefs.h>, or include both in the wrong order (<sys/cdefs.h> after
<machine/ansi.h>).

Affected files are:
<err.h>
<inttypes.h>
<netdb.h>
<stddef.h>
<string.h>
<syslog.h>
<time.h>
<vis.h>
<sys/dirent.h>
<sys/inttypes.h>
<sys/queue.h>
<sys/syslog.h>
<sys/times.h>

At least for <inttypes.h>, <stddef.h>, <string.h> and <time.h>, this
is contrary to ISO 9899:1999, aka the C standard, which specifies
(in 7.1.2/4) that "standard headers may be included in any order".

>How-To-Repeat:
Preprocess the following one-line code with `gcc -E' or another
standard preprocessor:

#include <stddef.h>

you will find in the output the faulty declaration with `__signed'.

>Fix:
Fix the above-stated include files to include <sys/cdefs.h> before
<machine/ansi.h>.

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202252127.g1PLRVU53282>