waf: Fix disable werror to actually work

Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
This commit is contained in:
Ryan Friedman 2023-05-29 19:42:12 -06:00 committed by Andrew Tridgell
parent 819f93b778
commit fd10bc35f0
2 changed files with 13 additions and 9 deletions

View File

@ -780,12 +780,17 @@ class sitl(Board):
('11','3','0'),
])
if cfg.options.Werror or cfg.env.CC_VERSION in gcc_whitelist:
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", "yes")
def get_name(self):
return self.__class__.__name__

View File

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