1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-19 18:50:24 +03:00

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)
This commit is contained in:
Amitay Isaacs 2018-07-03 13:56:13 +10:00 committed by Karolin Seeger
parent 4561e668a0
commit 89de78eedf

View File

@ -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)