Subject: RE: bin/22515: lint cares too much about comments
To: None <lha@stacken.kth.se>
From: Lagno, DenisX <denisx.lagno@intel.com>
List: netbsd-bugs
Date: 08/18/2003 14:02:52
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