wscript mystery
Hal Murray
halmurray at sonic.net
Wed Apr 8 08:28:47 UTC 2026
I added
('w_suggest_attribute_noreturn', "-Wsuggest-attribute=noreturn"),
+ ('w_switch_enum', "-Wswitch-enum"),
('w_write_strings', '-Wwrite-strings'),
That adds -Wswitch-enum to CFLAGS and HAS_w_switch_enum to config.h
I tested the everything by commenting out one case and got an error on
both gcc and clang.
So far, so good.
While poking around in the clang documentation, I discovered -Weverything
It seemed worth a try, so I added:
('w_disabled_optimization', "-Wdisabled-optimization"),
+ ('w_everything', "-Weverything"), # clang
('w_float_equal', "-Wfloat-equal"),
The first try didn't work because it found an error in the test code. :)
It was complaining about a missing extern or static.
So I added a static, and things seemed to work.
FRAGMENT = '''
-int tmp;
+static int tmp;
int main(int argc, char **argv) {
config says "yes" and puts HAS_w_everything into config.h, but
-Weverything wasn't getting added to CFLAGs.
How did "-Wswitch-enum" get added while "-Weverything" didn't?
Farther on in wscript, there is this code:
# debug warnings that are not available with all compilers
if ctx.env.HAS_w_implicit_fallthru:
ctx.env.CFLAGS = ['-Wimplicit-fallthrough=3'] + ctx.env.CFLAGS
if ctx.env.HAS_w_suggest_attribute_const:
ctx.env.CFLAGS = ['-Wsuggest-attribute=const'] + ctx.env.CFLAGS
if ctx.env.HAS_w_suggest_attribute_noreturn:
ctx.env.CFLAGS = ['-Wsuggest-attribute=noreturn'] + ctx.env.CFLAGS
if ctx.env.HAS_w_suggest_attribute_pure:
ctx.env.CFLAGS = ['-Wsuggest-attribute=pure'] + ctx.env.CFLAGS
if ctx.env.HAS_w_format_security:
ctx.env.CFLAGS = ['-Wformat-security'] + ctx.env.CFLAGS
Why is that code necessary? Didn't that stuff get added to CFLAGS by the
code that setup the HAS_w_xxx booleans?
I tried adding:
### Mystery why this is needed
if ctx.env.HAS_w_everything:
ctx.env.CFLAGS = ['-Weverything'] + ctx.env.CFLAGS
and waf doesn't like it.
Checking for type struct timex : no
The configuration failed
(complete log in /home/murray/ntpsec/raw/ted3/config.log)
There is nothing interesting in config.log
--
These are my opinions. I hate spam.
More information about the devel
mailing list