From 09962c1b7e37a9b3c02fa88e1253bee3b206ac19 Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Mon, 29 Apr 2019 13:07:08 -0700 Subject: [PATCH] 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 Reviewed-by: Andreas Schneider --- buildtools/wafsamba/samba_autoconf.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) -- 2.47.3