NetBSD Problem Report #22515

Received: (qmail 12572 invoked by uid 605); 17 Aug 2003 17:54:37 -0000
Message-Id: <20030817175427.531CBF3C1D@nutcracker.stacken.kth.se>
Date: Sun, 17 Aug 2003 19:54:27 +0200 (CEST)
From: lha@stacken.kth.se
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: lha@stacken.kth.se
To: gnats-bugs@gnats.netbsd.org
Subject: lint cares too much about comments
X-Send-Pr-Version: 3.95

>Number:         22515
>Category:       bin
>Synopsis:       lint cares too much about comments
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kristerw
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 17 17:55:00 +0000 2003
>Closed-Date:    
>Last-Modified:  Mon Aug 18 21:44:05 +0000 2003
>Originator:     Love
>Release:        NetBSD 1.6W
>Organization:
	SU
>Environment:
System: NetBSD nutcracker.stacken.kth.se 1.6W NetBSD 1.6W (NUTCRACKER) #32: Thu Aug 7 00:14:40 CEST 2003 lha@nutcracker.stacken.kth.se:/usr/src/sys/arch/i386/compile/NUTCRACKER i386
Architecture: i386
Machine: i386
>Description:

lint cares about comments in defines

>How-To-Repeat:

	$ cat > lint-define.c
	#define LINTFOO 1  /* comment */
	#define LINTFOO 1  /* diffrent */ 
	int foo;
	$ gcc -Wall -c lint-define.c 
	$ lint -z -v -u lint-define.c
	lint-define.c:
	lint-define.c:2: warning: `LINTFOO' redefined
	lint-define.c:1: warning: this is the location of the previous definition
	Lint pass2:

while


	$ cat > lint-define.c
	#define LINTFOO 1  /* comment */
	#define LINTFOO 1  /* comment */
	$ gcc -Wall -c lint-define.c 
	$ lint -z -v -u lint-define.c
	lint-define.c:
	Lint pass2:

is just fine

>Fix:

what should the behavior be ?
>Release-Note:
>Audit-Trail:

From: "Lagno, DenisX" <denisx.lagno@intel.com>
To: <lha@stacken.kth.se>
Cc: <netbsd-bugs@NetBSD.org>
Subject: RE: bin/22515: lint cares too much about comments
Date: Mon, 18 Aug 2003 14:02:52 +0400

 I think lint is right.  All text after #define XXX considered as =
 replacement list.  The following citation is from C++ standard though I =
 think it is valid for C also:

   16.3  Macro replacement                                  [cpp.replace]

 1 Two  replacement  lists are identical if and only if the preprocessing
   tokens in both have the same number, ordering,  spelling,  and  white-
   space  separation,  where  all  white-space separations are considered
   identical.

 2 An identifier currently defined as a macro without use of  lparen  (an
   object-like  macro)  may be redefined by another #define preprocessing
   directive provided that the second definition is an object-like  macro
   definition  and the two replacement lists are identical, otherwise the
   program is ill-formed.

 > -----Original Message-----
 > Subject: bin/22515: lint cares too much about comments
 > To: None <gnats-bugs@gnats.netbsd.org>
 > From: None <lha@stacken.kth.se>
 > List: netbsd-bugs
 > Date: 08/17/2003 19:54:27=20
 > >Number:         22515
 > >Category:       bin
 > >Synopsis:       lint cares too much about comments
 > >Confidential:   no
 > >Severity:       non-critical
 > >Priority:       low
 > >Responsible:    bin-bug-people
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Sun Aug 17 17:55:00 UTC 2003
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     Love
 > >Release:        NetBSD 1.6W
 > >Organization:
 > 	SU
 > >Environment:
 > System: NetBSD nutcracker.stacken.kth.se 1.6W NetBSD 1.6W=20
 > (NUTCRACKER) #32: Thu Aug 7 00:14:40 CEST 2003=20
 > lha@nutcracker.stacken.kth.se:/usr/src/sys/arch/i386/compile/N
 > UTCRACKER i386
 > Architecture: i386
 > Machine: i386
 > >Description:
 >=20
 > lint cares about comments in defines
 >=20
 > >How-To-Repeat:
 >=20
 > 	$ cat > lint-define.c
 > 	#define LINTFOO 1  /* comment */
 > 	#define LINTFOO 1  /* diffrent */=20
 > 	int foo;
 > 	$ gcc -Wall -c lint-define.c=20
 > 	$ lint -z -v -u lint-define.c
 > 	lint-define.c:
 > 	lint-define.c:2: warning: `LINTFOO' redefined
 > 	lint-define.c:1: warning: this is the location of the=20
 > previous definition
 > 	Lint pass2:
 >=20
 > while
 >=20
 >=20
 > 	$ cat > lint-define.c
 > 	#define LINTFOO 1  /* comment */
 > 	#define LINTFOO 1  /* comment */
 > 	$ gcc -Wall -c lint-define.c=20
 > 	$ lint -z -v -u lint-define.c
 > 	lint-define.c:
 > 	Lint pass2:
 >=20
 > is just fine
 >=20
 > >Fix:
 >=20
 > what should the behavior be ?
 > >Release-Note:
 > >Audit-Trail:
 > >Unformatted:
 >=20


From: "Lagno, DenisX" <denisx.lagno@intel.com>
To: <lha@stacken.kth.se>
Cc: <netbsd-bugs@NetBSD.org>
Subject: RE: bin/22515: lint cares too much about comments
Date: Mon, 18 Aug 2003 14:02:52 +0400

 I think lint is right.  All text after #define XXX considered as =
 replacement list.  The following citation is from C++ standard though I =
 think it is valid for C also:

   16.3  Macro replacement                                  [cpp.replace]

 1 Two  replacement  lists are identical if and only if the preprocessing
   tokens in both have the same number, ordering,  spelling,  and  white-
   space  separation,  where  all  white-space separations are considered
   identical.

 2 An identifier currently defined as a macro without use of  lparen  (an
   object-like  macro)  may be redefined by another #define preprocessing
   directive provided that the second definition is an object-like  macro
   definition  and the two replacement lists are identical, otherwise the
   program is ill-formed.

 > -----Original Message-----
 > Subject: bin/22515: lint cares too much about comments
 > To: None <gnats-bugs@gnats.netbsd.org>
 > From: None <lha@stacken.kth.se>
 > List: netbsd-bugs
 > Date: 08/17/2003 19:54:27=20
 > >Number:         22515
 > >Category:       bin
 > >Synopsis:       lint cares too much about comments
 > >Confidential:   no
 > >Severity:       non-critical
 > >Priority:       low
 > >Responsible:    bin-bug-people
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Sun Aug 17 17:55:00 UTC 2003
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     Love
 > >Release:        NetBSD 1.6W
 > >Organization:
 > 	SU
 > >Environment:
 > System: NetBSD nutcracker.stacken.kth.se 1.6W NetBSD 1.6W=20
 > (NUTCRACKER) #32: Thu Aug 7 00:14:40 CEST 2003=20
 > lha@nutcracker.stacken.kth.se:/usr/src/sys/arch/i386/compile/N
 > UTCRACKER i386
 > Architecture: i386
 > Machine: i386
 > >Description:
 >=20
 > lint cares about comments in defines
 >=20
 > >How-To-Repeat:
 >=20
 > 	$ cat > lint-define.c
 > 	#define LINTFOO 1  /* comment */
 > 	#define LINTFOO 1  /* diffrent */=20
 > 	int foo;
 > 	$ gcc -Wall -c lint-define.c=20
 > 	$ lint -z -v -u lint-define.c
 > 	lint-define.c:
 > 	lint-define.c:2: warning: `LINTFOO' redefined
 > 	lint-define.c:1: warning: this is the location of the=20
 > previous definition
 > 	Lint pass2:
 >=20
 > while
 >=20
 >=20
 > 	$ cat > lint-define.c
 > 	#define LINTFOO 1  /* comment */
 > 	#define LINTFOO 1  /* comment */
 > 	$ gcc -Wall -c lint-define.c=20
 > 	$ lint -z -v -u lint-define.c
 > 	lint-define.c:
 > 	Lint pass2:
 >=20
 > is just fine
 >=20
 > >Fix:
 >=20
 > what should the behavior be ?
 > >Release-Note:
 > >Audit-Trail:
 > >Unformatted:
 >=20


From: Krister Walfridsson <cato@df.lth.se>
To: lha@stacken.kth.se
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/22515: lint cares too much about comments
Date: Mon, 18 Aug 2003 22:34:41 +0200 (MEST)

 > >Description:
 >
 > lint cares about comments in defines
 >
 > >How-To-Repeat:
 >
 > 	$ cat > lint-define.c
 > 	#define LINTFOO 1  /* comment */
 > 	#define LINTFOO 1  /* diffrent */
 > 	int foo;
 > 	$ gcc -Wall -c lint-define.c
 > 	$ lint -z -v -u lint-define.c
 > 	lint-define.c:
 > 	lint-define.c:2: warning: `LINTFOO' redefined
 > 	lint-define.c:1: warning: this is the location of the previous definition
 > 	Lint pass2:

 Note that this warning does not come from lint...  lint uses gcc as the
 pre-processor, and running gcc with the flags normally passed by lint
 gives the warning:

 /usr/bin/cc -E -x c -U__GNUC__ -Wp,-$ -Wp,-CC -Wcomment -D__LINT__ -Dlint -D__lint -D__lint__ -Wtraditional lint-define.c
 lint-define.c:2: warning: `LINTFOO' redefined
 lint-define.c:1: warning: this is the location of the previous definition

    /Krister


From: Love <lha@stacken.kth.se>
To: Krister Walfridsson <cato@df.lth.se>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/22515: lint cares too much about comments
Date: Mon, 18 Aug 2003 22:47:56 +0200

 --=-=-=
 Content-Transfer-Encoding: quoted-printable


 Krister Walfridsson <cato@df.lth.se> writes:

 > Note that this warning does not come from lint...  lint uses gcc as the
 > pre-processor, and running gcc with the flags normally passed by lint
 > gives the warning:

 Ok, so the warning is from gcc. So lint is not to blame other that it makes
 gcc turn on the warning.

 My real problem is that all programs that uses lint and includes <des.h>
 and <openssl/des.h> gets this warning.

 : lha@nutcracker ; grep 'define DES_KEY_SZ' /usr/include/{openssl/,}des.h
 /usr/include/openssl/des.h:#define DES_KEY_SZ 8/*(sizeof(DES_cblock))*/
 /usr/include/des.h:#define DES_KEY_SZ        8/*(sizeof(des_cblock))*/


 Also, is the warning correct or just overly pedantic ?

 Love


 --=-=-=
 Content-Type: application/pgp-signature

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.2 (NetBSD)

 iQEVAwUAP0E7f3W+NPVfDpmCAQIUigf/ebzhNABycRJ1An61rKlT7WPoW/G3Ky50
 vUftQcc5JaEZh7qKg2yNKzis0o6uA30ihyFdT+RxNIkS+i597cFDtBJWC6aCi5QT
 gso2MWlv0ypfwVI9CLIwrUYyimXbDRnu4k2s/sCJi/dDvsc76kwQZHnrRW87TxkU
 nuMRnhyenVJBxXVvZ46kDh6+8IptvOo8nH6DGUOZu8u5Vr4kQcIYUI2SDQOeOTYz
 LLnAIQ/7h3OI+JaekUpCfr5blo8uFaYEE3VA4YrmTZFtsTWv5W5hvLG5quTfk1Km
 WsAGwykSA0eveDEQ3ZwdhS3UZXB5FmzAR9ftFWNcrXt0qWFKCM+LsQ==
 =bfx/
 -----END PGP SIGNATURE-----
 --=-=-=--

From: Krister Walfridsson <cato@df.lth.se>
To: Love <lha@stacken.kth.se>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/22515: lint cares too much about comments
Date: Mon, 18 Aug 2003 23:41:41 +0200 (MEST)

 On Mon, 18 Aug 2003, Love wrote:

 > Ok, so the warning is from gcc. So lint is not to blame other that it makes
 > gcc turn on the warning.
 >
 > My real problem is that all programs that uses lint and includes <des.h>
 > and <openssl/des.h> gets this warning.
 >
 > : lha@nutcracker ; grep 'define DES_KEY_SZ' /usr/include/{openssl/,}des.h
 > /usr/include/openssl/des.h:#define DES_KEY_SZ 8/*(sizeof(DES_cblock))*/
 > /usr/include/des.h:#define DES_KEY_SZ        8/*(sizeof(des_cblock))*/
 >
 >
 > Also, is the warning correct or just overly pedantic ?

 I agree with your interpretation of the standard, i.e. your usage is
 well defined.

 OTOH, you could argue that lint's job is to be overly pedantic... ;)

 But after looking some at the gcc source, I am rather sure that this
 is a bug in gcc.  I'll look some more on this, and discuss this on
 the gcc mailing list if I still think it is a bug after my
 investigation...

    /Krister

Responsible-Changed-From-To: bin-bug-people->kristerw 
Responsible-Changed-By: kristerw 
Responsible-Changed-When: Mon Aug 18 21:43:04 UTC 2003 
Responsible-Changed-Why:  
I'll deal with 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.