]> git.puffer.fish Git - matthieu/frr.git/commitdiff
build: add `-Werror` to xrelfo log format warnings
authorDavid Lamparter <equinox@diac24.net>
Tue, 13 Apr 2021 18:57:25 +0000 (20:57 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Thu, 24 Jun 2021 14:42:59 +0000 (16:42 +0200)
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>
lib/subdir.am
python/xrelfo.py

index b4ba078e4610a678060b99e12567c2db19ce7308..90301d800aecc5106ac3abc81af593cad53e329a 100644 (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:
index 0ecd0085798f440e15f3a663984c4e2f9b49f624..17262da8d98c60a5ff4c0821ecede551aa7448a9 100644 (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