From 89de78eedfbb1a11e4c6f94f1838d78576d2dd86 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 3 Jul 2018 13:56:13 +1000 Subject: wafsamba: Add strict option to CHECK_CODE Some compilers (e.g. xlc) ignores unsupported features, generates a warning, but does not fail compilation. This ensures that any compiler warnings are treated as errors and the feature support is correctly identified. This adds equivalent compiler option to -Werror for xlc. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493 Signed-off-by: Amitay Isaacs Reviewed-by: Andreas Schneider (cherry picked from commit c08d65c3eea997d52e311f027d84bdc3f9c93059) --- buildtools/wafsamba/samba_autoconf.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index cc08e0d5c3d..1b1e88a0d69 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -365,7 +365,7 @@ def CHECK_CODE(conf, code, define, headers=None, msg=None, cflags='', includes='# .', local_include=True, lib=None, link=True, define_ret=False, quote=False, - on_target=True): + on_target=True, strict=False): '''check if some code compiles and/or runs''' if CONFIG_SET(conf, define): @@ -395,6 +395,16 @@ def CHECK_CODE(conf, code, define, cflags = TO_LIST(cflags) + # Be strict when relying on a compiler check + # Some compilers (e.g. xlc) ignore non-supported features as warnings + if strict: + extra_cflags = None + if conf.env["CC_NAME"] == "gcc": + extra_cflags = "-Werror" + elif conf.env["CC_NAME"] == "xlc": + extra_cflags = "-qhalt=w" + cflags.append(extra_cflags) + if local_include: cflags.append('-I%s' % conf.curdir) -- cgit v1.2.1