Subject: Re: toolchain/30097: CFLAGS+=-W when ${WARNS} > 3
To: None <misc-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: David Holland <dholland@eecs.harvard.edu>
List: netbsd-bugs
Date: 10/13/2006 06:15:05
The following reply was made to PR toolchain/30097; it has been noted by GNATS.
From: dholland@eecs.harvard.edu (David Holland)
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: toolchain/30097: CFLAGS+=-W when ${WARNS} > 3
Date: Fri, 13 Oct 2006 02:11:17 -0400 (EDT)
> # in <bsd.sys.mk>:
> .if ${WARNS} > 3
> CFLAGS+= -W
> .endif
I tried this, and it doesn't work very well, at least for now.
The first thing you find is that there's a lot of code in libc that is
marked /*ARGSUSED*/ for lint but doesn't have __unused markings for
gcc. Patching all this in is lengthy and gets kind of ugly in places,
and after going through all of citrus I gave up.
So you'd need at least -W -Wno-unused.
This still breaks in a lot of places with warnings about missing
initializers; gcc doesn't like it when you do
struct foo foo_array[] = {
{ 1, 2, 3 },
{ 4, 5, 6 },
:
{ 0 },
};
because it really wants you to have an initializer for every field.
This behavior is, IMO, lame, so one turns out to want -W -Wno-unused
-Wno-missing-field-initializers.
I haven't gotten any further than this yet, but I thought I'd report
this much as it may be a while before I try again.
Oh, and according to the gcc4 manpage "-Wextra" is now the preferred
name for -W. FWIW.
--
- David A. Holland / dholland@eecs.harvard.edu