OSDN Git Service

Add a clang-analyzer scan-build make targets as well.
authorPeter Jones <pjones@redhat.com>
Tue, 17 Apr 2018 17:26:45 +0000 (13:26 -0400)
committerPeter Jones <pjones@redhat.com>
Tue, 17 Apr 2018 17:46:18 +0000 (13:46 -0400)
Signed-off-by: Peter Jones <pjones@redhat.com>
.gitignore
Make.scan-build [new file with mode: 0644]
Makefile
src/fix_coverity.h

index 5d1e6fb..5c3fd0e 100644 (file)
@@ -20,3 +20,4 @@ src/makeguids
 src/guid-symbols.c
 *.map
 cov-int
+scan-results/
diff --git a/Make.scan-build b/Make.scan-build
new file mode 100644 (file)
index 0000000..b3e03ee
--- /dev/null
@@ -0,0 +1,20 @@
+SCAN_BUILD ?= $(shell x=$$(which --skip-alias --skip-functions scan-build 2>/dev/null) ; [ -n "$$x" ] && echo 1)
+ifeq ($(SCAN_BUILD),)
+       SCAN_BUILD_ERROR = $(error scan-build not found)
+endif
+
+scan-test : ; $(SCAN_BUILD_ERROR)
+
+scan-clean : clean
+       @if [[ -d scan-results ]]; then rm -rf scan-results && echo "removed 'scan-results'"; fi
+
+scan-build : | scan-test
+scan-build : clean
+       scan-build -o scan-results make $(DASHJ) CC=clang all
+
+scan-build-all : | scan-test
+scan-build-all : clean
+       scan-build -o scan-results make $(DASHJ) CC=clang all
+
+.PHONY : scan-build scan-clean
+
index fcbda01..0f28a37 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,7 @@ include $(TOPDIR)/Make.version
 include $(TOPDIR)/Make.rules
 include $(TOPDIR)/Make.defaults
 include $(TOPDIR)/Make.coverity
+include $(TOPDIR)/Make.scan-build
 
 SUBDIRS := src docs
 
index 6bbcf7a..95a5c92 100644 (file)
@@ -8,6 +8,10 @@
 #ifndef FIX_COVERITY_H
 #define FIX_COVERITY_H
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
 #ifndef __COVERITY_GCC_VERSION_AT_LEAST
 #define __COVERITY_GCC_VERSION_AT_LEAST(x, y) 0
 #define FAKE__COVERITY_GCC_VERSION_AT_LEAST__