Subject: Re: toolchain/22118: make won't compile with -Wcast-qual -Wstrict-prototypes and more
To: None <tech-toolchain@netbsd.org>
From: Simon Gerraty <sjg@juniper.net>
List: tech-toolchain
Date: 07/11/2003 10:19:06
>Discovered while building bmake on freebsd 4.8, where the default warnings
>include
>-W -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Wnon-const-format
Fixing this needs a few things that don't currently seem to be covered
by share/misc/style.
For instance, function args that are unused.
Do we
1/ tag them with __unused gcc specific?
2/ frob the function to use them
Also const correctness hell... needs things like:
char default_op[] = "!=";
...
op = default_op;
style explicitly says don't assign in variable decls but the above is
an obvious? exception.
and inevitably you need to be able to discard const without a simple
cast to be safe. A static inline func discard_const() works well,
but I don't see evidence that we condone use of those.
I'm painfully aware that over use of static inlines leads to debug
hell. The alternative is a global union variable used by a macro,
or a static variable in each file that needs to use the macro.
A work-around (which will likely be needed for now) is to put some
make foo in bmake/Makefile.in to ensure that CFLAGS does not contain
any of the above -W flags.
--sjg