[Git][NTPsec/ntpsec][master] 4 commits: waf: drop -Wformat-nonliteral, default to -Wmissing-declarations

Gary E. Miller gitlab at mg.gitlab.com
Fri Apr 14 21:10:15 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
faf099c1 by Gary E. Miller at 2017-04-14T13:48:26-07:00
waf: drop -Wformat-nonliteral, default to -Wmissing-declarations

-Wformat-nonliteral complains about a feaature ntpd uses a lot.
-Wmissing-declarations now on by default.

- - - - -
5e8b5332 by Gary E. Miller at 2017-04-14T13:52:48-07:00
waf: Use -Wpacked by default, if available.

- - - - -
43d4d762 by Gary E. Miller at 2017-04-14T13:58:37-07:00
waf: Test for -fstack-protector-all use by default if exists.

Formerly it was set by compiler name.

- - - - -
772957ca by Gary E. Miller at 2017-04-14T14:07:59-07:00
waf: fix broken -Wsuggest-attribyte=[noreturn|pure] debug only

This used to work...

- - - - -


1 changed file:

- wafhelpers/configure.py


Changes:

=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -253,6 +253,7 @@ def cmd_configure(ctx, config):
         ctx.env.LDFLAGS += ["-lssp_nonshared"]
 
     cc_test_flags = [
+        ('f_stack_protector_all', '-fstack-protector-all'),
         ('PIC', '-fPIC'),
         ('PIE', '-pie -fPIE'),
         ('gnu99', '-std=gnu99'),
@@ -269,7 +270,9 @@ def cmd_configure(ctx, config):
         ('w_init_self', '-Winit-self'),
         ('w_inline', '-Winline'),
         ('w_invalid_pch', '-Winvalid-pch'),
+        ('w_missing_declarations', '-Wmissing-declarations'),
         ('w_multichar', '-Wmultichar'),
+        ('w_packed', '-Wpacked'),
         ('w_pointer_arith', '-Wpointer-arith'),
         ('w_shadow', '-Wshadow'),
         ('w_write_strings', '-Wwrite-strings'),
@@ -303,11 +306,9 @@ def cmd_configure(ctx, config):
             #"-Waggregate-return",    # breaks ldiv(), ntpcal_daysplit(),  etc.
             "-Wbad-function-cast",
             "-Wfloat-equal",          # Not Ready For Prime Time
-            "-Wformat-nonliteral",    # needs -Wformat
-            "-Wmissing-declarations", # Not Ready For Prime Time
+            # "-Wformat-nonliteral",  # complains about a used feature
             "-Wmissing-format-attribute",
             # "-Wnested-externs",     # incompatible w/ Unity...
-            "-Wpacked",
             # "-Wpadded",             # duck... over 3k warnings
             # "-Wredundant-decls",    # incompatible w/ Unity
             "-Wswitch-default",       # warns on Bison bug
@@ -380,6 +381,10 @@ int main(int argc, char **argv) {
         ctx.env.CFLAGS = ["-flto"] + ctx.env.CFLAGS
 
     # debug warnings that are not available with all compilers
+    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
     if ctx.env.HAS_w_format_signedness:
@@ -403,12 +408,18 @@ int main(int argc, char **argv) {
         ctx.env.CFLAGS = ['-Wdisabled-optimization'] + ctx.env.CFLAGS
     if ctx.env.HAS_w_cast_align:
         ctx.env.CFLAGS = ['-Wcast-align'] + ctx.env.CFLAGS
+    if ctx.env.HAS_w_missing_declarations:
+        ctx.env.CFLAGS = ['-Wmissing-declarations'] + ctx.env.CFLAGS
     if ctx.env.HAS_w_cast_qual:
         ctx.env.CFLAGS = ['-Wcast-qual'] + ctx.env.CFLAGS
+    if ctx.env.HAS_w_packed:
+        ctx.env.CFLAGS = ['-Wpacked'] + ctx.env.CFLAGS
     if ctx.env.HAS_w_shadow:
         ctx.env.CFLAGS = ['-Wshadow'] + ctx.env.CFLAGS
     if ctx.env.HAS_w_sign_conversion:
         ctx.env.CFLAGS = ['-Wsign-conversion'] + ctx.env.CFLAGS
+    if ctx.env.HAS_f_stack_protector_all:
+        ctx.env.CFLAGS = ['-fstack-protector-all'] + ctx.env.CFLAGS
 
     # old gcc takes -z,relro, but then barfs if -fPIE available and used.
     # ("relro", "-Wl,-z,relro"), # marks some sections read only
@@ -432,9 +443,6 @@ int main(int argc, char **argv) {
     elif ctx.env.CC_NAME == "clang":
         # used on macOS, FreeBSD,
         # FORTIFY needs LTO to work well
-        ctx.env.CFLAGS = [
-            "-fstack-protector-all",    # hardening
-            ] + ctx.env.CFLAGS
         if ctx.env.DEST_OS not in ["darwin", "freebsd"]:
             # -flto breaks tests on macOS
             ctx.env.CFLAGS = [
@@ -444,11 +452,7 @@ int main(int argc, char **argv) {
             ctx.env.LDFLAGS += [
                 "-Wl,-z,relro",  # hardening, marks some section read only,
                 ]
-    else:
-        # gcc, probably
-        ctx.env.CFLAGS = [
-            "-fstack-protector-all",    # hardening
-            ] + ctx.env.CFLAGS
+    # else:  # gcc, probably
 
     # XXX: hack
     if ctx.env.DEST_OS in ["freebsd", "openbsd"]:



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/a794256bf41a81e58262ea597a97059387210d4b...772957ca2403c98109de810fd39f0987afd7397f

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/a794256bf41a81e58262ea597a97059387210d4b...772957ca2403c98109de810fd39f0987afd7397f
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170414/a24f9a38/attachment.html>


More information about the vc mailing list