build: add `-Werror` to xrelfo log format warnings

Adding a `\n' should now produce a warning.  Controlled by `-Werror` so
if you're doing a dev build and it's warning about some `prefix2str`
that should be converted to `%pFX`, you can turn off `-Werror` to fix it
later like with all other warnings.

Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
David Lamparter 2021-04-13 20:57:25 +02:00 committed by David Lamparter
parent 6418e2d342
commit 13f9aea383
2 changed files with 6 additions and 2 deletions

View File

@ -464,7 +464,7 @@ endif
SUFFIXES += .xref
%.xref: % $(CLIPPY)
$(AM_V_XRELFO) $(CLIPPY) $(top_srcdir)/python/xrelfo.py $(XRELFO_FLAGS) -o $@ $<
$(AM_V_XRELFO) $(CLIPPY) $(top_srcdir)/python/xrelfo.py $(WERROR) $(XRELFO_FLAGS) -o $@ $<
# dependencies added in python/makefile.py
frr.xref:

View File

@ -357,6 +357,7 @@ def main():
argp.add_argument('--out-by-file', type=str, help='write by-file JSON output')
argp.add_argument('-Wlog-format', action='store_const', const=True)
argp.add_argument('-Wlog-args', action='store_const', const=True)
argp.add_argument('-Werror', action='store_const', const=True)
argp.add_argument('--profile', action='store_const', const=True)
argp.add_argument('binaries', metavar='BINARY', nargs='+', type=str, help='files to read (ELF files or libtool objects)')
args = argp.parse_args()
@ -380,9 +381,12 @@ def _main(args):
traceback.print_exc()
for option in dir(args):
if option.startswith('W'):
if option.startswith('W') and option != 'Werror':
checks = sorted(xrelfo.check(args))
sys.stderr.write(''.join([c[-1] for c in checks]))
if args.Werror and len(checks) > 0:
errors += 1
break