From owner-freebsd-current@FreeBSD.ORG Sat Dec 3 23:06:12 2005 Return-Path: X-Original-To: current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0DF8C16A41F; Sat, 3 Dec 2005 23:06:12 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0740C43D53; Sat, 3 Dec 2005 23:06:10 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from localhost (rocky.ip.net.ua [82.193.96.2]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id jB3N69cM003790; Sun, 4 Dec 2005 01:06:09 +0200 (EET) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua ([82.193.96.10]) by localhost (rocky.ipnet [82.193.96.2]) (amavisd-new, port 10024) with LMTP id 03184-02-3; Sun, 4 Dec 2005 01:06:07 +0200 (EET) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id jB3N4SJv003741 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 4 Dec 2005 01:04:28 +0200 (EET) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.13.4/8.13.4) id jB3N4VwD098096; Sun, 4 Dec 2005 01:04:31 +0200 (EET) (envelope-from ru) Date: Sun, 4 Dec 2005 01:04:31 +0200 From: Ruslan Ermilov To: current@FreeBSD.org Message-ID: <20051203230431.GL960@ip.net.ua> References: <20051203224518.GJ960@ip.net.ua> <20051203225517.GK960@ip.net.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LJm8egi4vkexsie5" Content-Disposition: inline In-Reply-To: <20051203225517.GK960@ip.net.ua> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at ip.net.ua Cc: re@FreeBSD.org Subject: Re: Beware of subtle bugs due to cpp(1) limitations! X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2005 23:06:12 -0000 --LJm8egi4vkexsie5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Dec 04, 2005 at 12:55:17AM +0200, Ruslan Ermilov wrote: > On Sun, Dec 04, 2005 at 12:45:18AM +0200, Ruslan Ermilov wrote: > > Hi there, > >=20 > > cpp(1) only supports integer expressions, so the following > >=20 > > #define FOO foo > > #if FOO =3D=3D bar > >=20 > > will always evaluate to true, because "foo" and "bar" will > > be treated as zeroes, as explained in cpp.info. [...] > > The season for more bugs of this type is declared open! :-) > >=20 > ``cpp -Wundef'' will allow us to find all these bugs. >=20 Here we go: %%% Index: share/mk/bsd.sys.mk =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/share/mk/bsd.sys.mk,v retrieving revision 1.37 diff -u -r1.37 bsd.sys.mk --- share/mk/bsd.sys.mk 16 Jan 2005 21:18:16 -0000 1.37 +++ share/mk/bsd.sys.mk 3 Dec 2005 22:57:36 -0000 @@ -11,7 +11,7 @@ .if !defined(NO_WARNS) && ${CC} !=3D "icc" . if defined(WARNS) . if ${WARNS} >=3D 1 -CWARNFLAGS +=3D -Wsystem-headers +CWARNFLAGS +=3D -Wsystem-headers -Wundef . if !defined(NO_WERROR) CWARNFLAGS +=3D -Werror . endif Index: sys/conf/kern.mk =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/conf/kern.mk,v retrieving revision 1.46 diff -u -r1.46 kern.mk --- sys/conf/kern.mk 15 Jul 2005 11:45:30 -0000 1.46 +++ sys/conf/kern.mk 3 Dec 2005 22:58:41 -0000 @@ -12,7 +12,7 @@ .else CWARNFLAGS?=3D -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototype= s \ -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \ - -fformat-extensions -std=3Dc99 + -Wundef -fformat-extensions -std=3Dc99 .endif # # The following flags are next up for working on: %%% Should I commit it to force a thorough fixing? (The #ifdef notdef/notyet are not affected by this change.) Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --LJm8egi4vkexsie5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) iD8DBQFDkiR/qRfpzJluFF4RAuMlAKCNQUZjJoYid3yNHugda2NNT5Z1tgCdF7ya L1L9gThFFm4iuEMNxYBZHSU= =bmc7 -----END PGP SIGNATURE----- --LJm8egi4vkexsie5--