NetBSD Problem Report #41327

From perry@piermont.com  Fri May  1 22:38:14 2009
Return-Path: <perry@piermont.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 4B3C563B8A5
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  1 May 2009 22:38:14 +0000 (UTC)
Message-Id: <20090501223749.085558D1FDB@snark.piermont.com>
Date: Fri,  1 May 2009 18:37:49 -0400 (EDT)
From: perry@piermont.com
Reply-To: perry@piermont.com
To: gnats-bugs@gnats.NetBSD.org
Subject: lint fails to understand c99 decl in for loop.
X-Send-Pr-Version: 3.95

>Number:         41327
>Category:       toolchain
>Synopsis:       lint fails to understand c99 decl in for loop.
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    toolchain-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 01 22:40:00 +0000 2009
>Closed-Date:    Fri May 01 22:50:52 +0000 2009
>Last-Modified:  Fri May 01 22:50:52 +0000 2009
>Originator:     Perry E. Metzger
>Release:        NetBSD 4.99.28
>Organization:
Perry E. Metzger		perry@piermont.com
>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:/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:


>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: perry@NetBSD.org
State-Changed-When: Fri, 01 May 2009 22:50:52 +0000
State-Changed-Why:
christos fixed this.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.