NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/41327: lint fails to understand c99 decl in for loop.



>Number:         41327
>Category:       toolchain
>Synopsis:       lint fails to understand c99 decl in for loop.
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 01 22:40:00 +0000 2009
>Originator:     Perry E. Metzger
>Release:        NetBSD 4.99.28
>Organization:
Perry E. Metzger                perry%piermont.com@localhost
>Environment:
        
        
System: NetBSD snark.cb.piermont.com 4.99.28 NetBSD 4.99.28 (ZWEI) #0: Sun Aug 
12 13:52:43 EDT 2007 
perry%snark.piermont.com@localhost:/usr/src/sys/arch/amd64/compile/ZWEI amd64
Architecture: x86_64
Machine: amd64
>Description:

The following is fine c99 and compiles and runs just fine, but results
in a syntax error if you use it with lint -S:

--------------------
#include <stdio.h>

int main(int argc, char **argv)
{
    for (int i = 0; i < 10; i++)
        printf("i = %d\n", i);
}
--------------------

This turns out to be a serious problem if you want to use c99isms in
portions of the tree that get linted, like libraries.

>How-To-Repeat:

$ lint -chapbxzFS lintest.c
lintest.c:
lintest.c(5): syntax error 'int' [249]
lintest.c(5): i undefined [99]
[etc, etc.]

>Fix:
        

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index