summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorChristof Schmitt <cs@samba.org>2019-04-29 13:07:08 -0700
committerAndreas Schneider <asn@cryptomilk.org>2019-04-30 17:34:21 +0000
commit09962c1b7e37a9b3c02fa88e1253bee3b206ac19 (patch)
treed0531338dd25835ff98dee740a4d5b2b26673c12 /buildtools
parentd88f1c82b2fa682ca3ed0256b4728f7e1b6999fc (diff)
downloadsamba-09962c1b7e37a9b3c02fa88e1253bee3b206ac19.tar.gz
wafsamba: Add compiler check for missing field initializer check
The commit cf79ee15 wafsamba: Enable warnings for missing field initializer enabled a compiler check for warnings about missing initializers for all developer builds. This fails with older compilers, e.g. gcc on RHEL7. Add a waf check around adding the compiler option to avoid the failure with older compilers. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba_autoconf.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index f2b049e40a7..06ec7da333a 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -731,7 +731,13 @@ def SAMBA_CONFIG_H(conf, path=None):
conf.ADD_CFLAGS('-Wall', testflags=True)
conf.ADD_CFLAGS('-Wshadow', testflags=True)
conf.ADD_CFLAGS('-Wmissing-prototypes', testflags=True)
- conf.ADD_CFLAGS('-Wmissing-field-initializers', testflags=True)
+ if CHECK_CODE(conf,
+ 'struct a { int b; }; struct c { struct a d; } e = { };',
+ 'CHECK_C99_INIT',
+ link=False,
+ cflags='-Wmissing-field-initializers -Werror=missing-field-initializers',
+ msg="Checking C99 init of nested structs."):
+ conf.ADD_CFLAGS('-Wmissing-field-initializers', testflags=True)
conf.ADD_CFLAGS('-Wcast-align -Wcast-qual', testflags=True)
conf.ADD_CFLAGS('-fno-common', testflags=True)