Subject: Re: bin/22515: lint cares too much about comments
To: Lagno, DenisX <denisx.lagno@intel.com>
From: Love <lha@stacken.kth.se>
List: netbsd-bugs
Date: 08/18/2003 13:16:25
--=-=-=
Content-Transfer-Encoding: quoted-printable
"Lagno, DenisX" <denisx.lagno@intel.com> writes:
> 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:
C99 have simular text in 6.10.3 Macro replacement, but C99 also say:
5.1.1.2 Translation phases
1 The precedence among the syntax rules of translation is specified by the
following phases.
1. [..]
2. [..]
3. The source file is decomposed into preprocessing tokens and
sequences of white-space characters (including comments). A source
file shall not end in a partial preprocessing token or in a partial
comment. Each comment is replaced by one space character. New-line
characters are retained. Whether each nonempty sequence of
white-space characters other than new-line is retained or replaced by
one space character is implementation-defined.
4. Preprocessing directives are executed, macro invocations are
expanded, and _Pragma unary operator expressions are executed. If a
character sequence that matches the syntax of a universal character
name is produced by token concatenation (6.10.3.3), the behavior is
undefined. A #include preprocessing directive causes the named header
or source file to be processed from phase 1 through phase 4,
recursively. All preprocessing directives are then deleted.
So shouldn't lint check the preprosessor directive #define after comments
have been processed/replaced with space ?
Love
--=-=-=
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (NetBSD)
iQEVAwUAP0C1kHW+NPVfDpmCAQLfdwgApAlCaqEtLu8M91COyqiBaQ1P5fDDIisi
VJU79PDY82c43e2ARsuSamTLBoV4/iBBHaVOjCRkFw+VKOBjzYYlUoLG+k/wSptL
PNym6M2sE/x6gYqNXXebd5JH/p7u2fvDkZdZSknGhm+rDi6GaNiUHHTAtnFTISIF
GJPNCaj5Bm7PfD3qArePFMa1JfNl0MmNkWF+bZet+Amb3OoXi0h4q+HJhQfHHT3v
FrhfqRBc0x6vI4NqEn6+Xuza9cXk+H01xL15vueaNHLlJ5njT6Eh5ychfAoXa0pr
tD6S5eYOF6jYovID5Z4wLzfdoY61mP03j+o+QoD825d0osaFxkfNsw==
=t7Rc
-----END PGP SIGNATURE-----
--=-=-=--