]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Makefile rule for static analyzer
authorMaria Matejka <mq@ucw.cz>
Wed, 14 Aug 2019 08:14:15 +0000 (10:14 +0200)
committerMaria Matejka <mq@ucw.cz>
Sat, 17 Aug 2019 11:44:43 +0000 (13:44 +0200)
Makefile.in

index c8168bbe4cb1a0988a3d73bb8b562ac8b16db921..ccefb3cd653e05edbb052c77c0026a5e919081a7 100644 (file)
@@ -58,7 +58,7 @@ endif
 docgoals := docs userdocs progdocs
 testgoals := check test tests tests_run
 cleangoals := clean distclean testsclean
-.PHONY: all daemon cli $(docgoals) $(testgoals) $(cleangoals) tags cscope
+.PHONY: all daemon cli $(docgoals) $(testgoals) $(cleangoals) tags cscope static-scan
 all: daemon cli
 
 daemon: $(daemon)
@@ -159,6 +159,13 @@ ifeq ($(MAKECMDGOALS),)
 -include $(shell find $(objdir) -name "*.d")
 endif
 
+STATIC_CHECKERS := nullability.NullableDereferenced nullability.NullablePassedToNonnull nullability.NullableReturnedFromNonnull optin.portability.UnixAPI valist.CopyToSelf valist.Uninitialized valist.Unterminated
+STATIC_SCAN_FLAGS := --force-analyze-debug-code -o $(objdir)/static-scan/ $(addprefix -enable-checker ,$(STATIC_CHECKERS))
+
+static-scan:
+       $(MAKE) clean
+       scan-build $(STATIC_SCAN_FLAGS) $(MAKE)
+
 tags:
        cd $(srcdir) ; etags -lc `find $(dirs) -name *.[chY]`