diff options
author | Amitay Isaacs <amitay@gmail.com> | 2018-07-03 13:56:13 +1000 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2018-07-10 10:44:13 +0200 |
commit | 89de78eedfbb1a11e4c6f94f1838d78576d2dd86 (patch) | |
tree | ebe206132d4b70a0eb137067ab2327859009e391 | |
parent | 4561e668a0b31aef2d812804c4c26343a40d3b14 (diff) | |
download | samba-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.py | 12 |
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) |