waf: added -Werror configure option

for building with error on any warning
This commit is contained in:
Andrew Tridgell 2020-04-24 12:26:54 +10:00
parent 6222649e37
commit f352b6d107
2 changed files with 25 additions and 5 deletions

View File

@ -122,6 +122,7 @@ class Board:
'-Werror=parentheses',
'-Werror=format-extra-args',
'-Werror=ignored-qualifiers',
'-DARDUPILOT_BUILD',
]
if cfg.options.scripting_checks:
@ -205,6 +206,7 @@ class Board:
'-Wfatal-errors',
'-Wno-trigraphs',
'-Werror=parentheses',
'-DARDUPILOT_BUILD',
]
if 'clang++' in cfg.env.COMPILER_CXX:
@ -249,6 +251,15 @@ class Board:
'-Werror=implicit-fallthrough',
]
if cfg.options.Werror:
errors = ['-Werror',
'-Werror=missing-declarations',
'-Werror=float-equal',
'-Werror=undef',
]
env.CFLAGS += errors
env.CXXFLAGS += errors
if cfg.env.DEBUG:
env.CXXFLAGS += [
'-g',
@ -481,11 +492,6 @@ class chibios(Board):
'-Wframe-larger-than=1300',
'-fsingle-precision-constant',
'-Wno-attributes',
'-Wno-error=double-promotion',
'-Wno-error=missing-declarations',
'-Wno-error=float-equal',
'-Wno-error=undef',
'-Wno-error=cpp',
'-fno-exceptions',
'-Wall',
'-Wextra',
@ -521,6 +527,15 @@ class chibios(Board):
'-D__USE_CMSIS',
'-Werror=deprecated-declarations'
]
if not cfg.options.Werror:
env.CFLAGS += [
'-Wno-error=double-promotion',
'-Wno-error=missing-declarations',
'-Wno-error=float-equal',
'-Wno-error=undef',
'-Wno-error=cpp',
]
env.CXXFLAGS += env.CFLAGS + [
'-fno-rtti',
'-fno-threadsafe-statics',

View File

@ -76,6 +76,11 @@ def options(opt):
default=False,
help='Configure as debug variant.')
g.add_option('--Werror',
action='store_true',
default=False,
help='build with -Werror.')
g.add_option('--toolchain',
action='store',
default=None,