From fd10bc35f0e4c745412c5a5a30b8fd0b0359539d Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Mon, 29 May 2023 19:42:12 -0600 Subject: [PATCH] waf: Fix disable werror to actually work Signed-off-by: Ryan Friedman --- Tools/ardupilotwaf/boards.py | 17 +++++++++++------ wscript | 5 ++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index bb03220f70..016fda3e78 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -780,13 +780,18 @@ class sitl(Board): ('11','3','0'), ]) - if cfg.options.Werror or cfg.env.CC_VERSION in gcc_whitelist: - cfg.msg("Enabling -Werror", "yes") - if '-Werror' not in env.CXXFLAGS: - env.CXXFLAGS += [ '-Werror' ] + if cfg.env.CC_VERSION in gcc_whitelist or cfg.options.Werror: + if not cfg.options.disable_Werror: + cfg.msg("Enabling -Werror", "yes") + if '-Werror' not in env.CXXFLAGS: + env.CXXFLAGS += [ '-Werror' ] + else: + cfg.msg("Enabling -Werror", "no") + if '-Werror' in env.CXXFLAGS: + env.CXXFLAGS.remove('-Werror') else: - cfg.msg("Enabling -Werror", "no") - + cfg.msg("Enabling -Werror", "yes") + def get_name(self): return self.__class__.__name__ diff --git a/wscript b/wscript index 8b0d315001..c7ad5d4aa4 100644 --- a/wscript +++ b/wscript @@ -590,10 +590,9 @@ def configure(cfg): cfg.define('_GNU_SOURCE', 1) if cfg.options.Werror: + # print(cfg.options.Werror) if cfg.options.disable_Werror: - raise ValueError("Cannot enable and disable Werror at the same time") - else: - cfg.options.Werror = not cfg.options.disable_Werror + cfg.options.Werror = False cfg.write_config_header(os.path.join(cfg.variant, 'ap_config.h'), guard='_AP_CONFIG_H_')