standards/116346: FreeBSD has no conforming C implementation

Olaf Seibert rhialto at falu.nl
Fri Sep 14 05:00:07 PDT 2007


>Number:         116346
>Category:       standards
>Synopsis:       FreeBSD has no conforming C implementation
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-standards
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 14 12:00:05 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Olaf Seibert
>Release:        6.1
>Organization:
>Environment:
FreeBSD twoquid.cs.ru.nl 6.1-RELEASE FreeBSD 6.1-RELEASE #2: Mon Mar 19 15:05:26 CET 2007     root at twoquid.cs.ru.nl:/usr/src/sys/amd64/compile/TWOQUID  amd64
>Description:
The following strictly conforming little C program fails to compile on
FreeBSD 6.1 (and I've had the same report about FreeBSD 7).

int main(int argc, char **argv)
{
    int unix = 2;
    return 0;
}

$ uname -a
FreeBSD twoquid.cs.ru.nl 6.1-RELEASE FreeBSD 6.1-RELEASE #2: Mon Mar 19 15:05:26 CET 2007     root at twoquid.cs.ru.nl:/usr/src/sys/amd64/compile/TWOQUID  amd64
$ gcc c.c
c.c: In function `main':
c.c:3: error: syntax error before numeric constant

The problem is the pre-definition of the preprocessor symbol "unix". The
C standard does not allow that.

Reference: ISO/IEC 9899:TC2 section 7.1.3 "Reserved Identifiers".
Para 1 lists the identifiers the compiler may predefine ("reserve").
Para 2: "No other identifiers are reserved".
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf

Section 4 "Conformance" para 6 says (implies) that a conforming
implementation (of C) reserves no identifiers other than those explictly
reserved in the C standard.

Therefore, FreeBSD has no conforming C implementation.

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert      -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl        -- Cetero censeo "authored" delendum esse.

>How-To-Repeat:
compile the above program.
>Fix:
Remove the predefine in the gcc build.

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


More information about the freebsd-standards mailing list