]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add cppcheck Makefile target
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 2 Jan 2016 18:39:42 +0000 (19:39 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 2 Jan 2016 18:39:42 +0000 (19:39 +0100)
Makefile.in
cppcheck-suppressions.txt [new file with mode: 0644]
dev.mk.in

index 30beb2bfd5dbb3835a822ab9f60ea34382f91fe1..c6cdc048491c8b63e1da41bcdcb3eaa4f71c38e2 100644 (file)
@@ -22,11 +22,32 @@ all_cflags = $(CFLAGS)
 all_cppflags = @DEFS@ -DSYSCONFDIR=$(sysconfdir) -I. -I$(srcdir) $(CPPFLAGS)
 extra_libs = @extra_libs@
 
-base_sources = \
-    ccache.c mdfour.c hash.c execute.c util.c args.c stats.c version.c \
-    cleanup.c snprintf.c unify.c manifest.c hashtable.c hashtable_itr.c \
-    murmurhashneutral2.c hashutil.c getopt_long.c exitfn.c lockfile.c \
-    counters.c language.c compopt.c conf.c
+non_3pp_sources = \
+    args.c \
+    ccache.c \
+    cleanup.c \
+    compopt.c \
+    conf.c \
+    counters.c \
+    execute.c \
+    exitfn.c \
+    hash.c \
+    hashutil.c \
+    language.c \
+    lockfile.c \
+    manifest.c \
+    mdfour.c \
+    stats.c \
+    unify.c \
+    util.c \
+    version.c
+3pp_sources = \
+    getopt_long.c \
+    hashtable.c \
+    hashtable_itr.c \
+    murmurhashneutral2.c \
+    snprintf.c
+base_sources = $(non_3pp_sources) $(3pp_sources)
 base_objs = $(base_sources:.c=.o)
 
 ccache_sources = main.c $(base_sources)
diff --git a/cppcheck-suppressions.txt b/cppcheck-suppressions.txt
new file mode 100644 (file)
index 0000000..98310e2
--- /dev/null
@@ -0,0 +1,3 @@
+ConfigurationNotChecked
+missingIncludeSystem
+unusedFunction:test/test_*
index def493a26c885f4f31f50019f60ec4e11141fffa..a6176f166090de6a89203e7178e05908a11ad39d 100644 (file)
--- a/dev.mk.in
+++ b/dev.mk.in
@@ -4,6 +4,8 @@ all_cflags += -Werror
 all_cppflags += -MD -MP -MF .deps/$(subst .._,,$(subst /,_,$<)).d
 
 ASCIIDOC = asciidoc
+CPPCHECK = cppcheck
+CPPCHECK_SUPPRESSIONS = cppcheck-suppressions.txt
 GPERF = gperf
 XSLTPROC = xsltproc
 MANPAGE_XSL = $(shell if [ -e /usr/local/etc/asciidoc/docbook-xsl/manpage.xsl ]; \
@@ -151,6 +153,12 @@ ccache.1: MANUAL.xml
 check-syntax:
        $(CC) $(all_cppflags) -I. $(all_cflags) -S -o /dev/null $(CHK_SOURCES)
 
+.PHONY: cppcheck
+cppcheck:
+       $(CPPCHECK) --suppressions-list=$(CPPCHECK_SUPPRESSIONS) \
+         --inline-suppr -q --enable=all \
+         $(non_3pp_sources) main.c $(test_sources)
+
 .PHONY: uncrustify
 uncrustify:
        uncrustify -c uncrustify.cfg --no-backup --replace $(filter-out $(uncrustify_exclude_files), $(base_sources)) $(test_sources)