Subject: Re: toolchain/22118: make won't compile with -Wcast-qual -Wstrict-prototypes and more
To: None <tech-toolchain@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-toolchain
Date: 07/11/2003 20:31:43
In article <20030711171907.468B6206B2@frodo.juniper.net>,
Simon Gerraty <sjg@juniper.net> wrote:
>
>>Discovered while building bmake on freebsd 4.8, where the default warnings
>>include 
>>-W -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Wnon-const-format
>
>For instance, function args that are unused.
>Do we 
>1/ tag them with __unused	gcc specific?

sure.

>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.

#define __UNCONST(pointer) strchr(pointer, *(char *)(void *)pointer)

christos