summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2018-07-03 13:56:13 +1000
committerKarolin Seeger <kseeger@samba.org>2018-07-10 10:44:13 +0200
commit89de78eedfbb1a11e4c6f94f1838d78576d2dd86 (patch)
treeebe206132d4b70a0eb137067ab2327859009e391
parent4561e668a0b31aef2d812804c4c26343a40d3b14 (diff)
downloadsamba-89de78eedfbb1a11e4c6f94f1838d78576d2dd86.tar.gz
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 <amitay@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> (cherry picked from commit c08d65c3eea997d52e311f027d84bdc3f9c93059)
-rw-r--r--buildtools/wafsamba/samba_autoconf.py12
1 files changed, 11 insertions, 1 deletions
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)