Subject: -Wuninitalized comments [was Re: CVS commit: src/sys/dist/pf/net]
To: None <tech-userlevel@NetBSD.org>
From: Luke Mewburn <lukem@NetBSD.org>
List: tech-userlevel
Date: 06/15/2005 08:27:41
--/Kwy1es1GwkEJhNg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Tue, Jun 14, 2005 at 03:51:58PM -0500, James Chacon wrote:
| On Tue, Jun 14, 2005 at 11:40:59AM +1000, Luke Mewburn wrote:
| > On Mon, Jun 13, 2005 at 08:33:54PM +0000, James Chacon wrote:
| > |=20
| > | Module Name: src
| > | Committed By: jmc
| > | Date: Mon Jun 13 20:33:54 UTC 2005
| > |=20
| > | Modified Files:
| > | src/sys/dist/pf/net: pf.c
| > |=20
| > | Log Message:
| > | Fix unitialized warnings that only crop up on m68k. XXGCC taggedd
| >=20
| > For consistency with other occurrences of XXXGCC in the source,
| > could you move these to to separate initializations (after the
| > variable declaration block) and make the comment text more
| > consistent (e.g., "XXXGCC -Wuninitialized m68k")?
|=20
| Will do. Are we marking all -Wuninitialized with XXXGCC or only ones th=
at
| showed up on specific archs only?
All that we add in 3RDARTY code (**/dist/*), not just MD.
In NetBSD code in some cases I haven't marked the initialization
if it was an initialization that I would have done anyway as a
coding style issue, I may not have done this.
However, if in doubt I used:
somevar =3D 0; /* XXXGCC -Wuninitialized */
(after ensuring that `0' was the appropriate initialization value;
sometimes another value such as a code-specific error code was
more appropriate).
(There's an argument to be had that I should have marked more
of them this way).
I also don't just initialize the variable to appease the warning,
because that can mask a bug; careful analysis of the code flow
is required. I discovered at least 30 bugs this way, including
some potential data corruption issue.
Cheers,
Luke.
--/Kwy1es1GwkEJhNg
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (NetBSD)
iD8DBQFCr1ndpBhtmn8zJHIRAp+bAKCvdMBZOES9fsIQmMTVdpfhyDP03QCfVexP
C/YiG5O7kbqg1k3iaONrHoM=
=ZRAl
-----END PGP SIGNATURE-----
--/Kwy1es1GwkEJhNg--