Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Sep 2007 11:50:12 GMT
From:      Olaf Seibert <rhialto@falu.nl>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   standards/116346: FreeBSD has no conforming C implementation
Message-ID:  <200709141150.l8EBoC1s068421@www.freebsd.org>
Resent-Message-ID: <200709141200.l8EC057i080617@freefall.freebsd.org>

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

>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@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@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:



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