add cppcheck
authorMichael Wallner <mike@php.net>
Wed, 21 Sep 2016 08:15:19 +0000 (10:15 +0200)
committerMichael Wallner <mike@php.net>
Wed, 21 Sep 2016 08:15:19 +0000 (10:15 +0200)
Makefile
cppcheck.suppressions [new file with mode: 0644]

index efe8378afc5ca7101399dc8185246c0412c7dc32..4f315ee60e8b1b8178324c257a7b834b096ecf72 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,8 @@ PHP_VERSION_MAJOR = $(firstword $(subst ., ,$(PHP)))
 PHP_VERSIONS_JSON = $(srcdir)/php-versions$(PHP_VERSION_MAJOR).json
 PHP_VERSION ?= $(shell test -e $(PHP_VERSIONS_JSON) && cat $(PHP_VERSIONS_JSON) | $(makdir)/php-version.php $(PHP))
 
+CPPCHECK ?= -v -j $(JOBS) --std=c89 --enable=warning,portability,style --error-exitcode=42 --suppressions-list=$(makdir)/cppcheck.suppressions -I.
+
 .SUFFIXES:
 
 .PHONY: all
@@ -140,9 +142,13 @@ ext-rm: pecl-rm
 ext: pecl-check pecl
        $(makdir)/check-packagexml.php package.xml
 
-.PHONY: php
+.PHONY: test
 test: php
        REPORT_EXIT_STATUS=1 $(bindir)/php run-tests.php -q -p $(bindir)/php --set-timeout 300 --show-diff tests
 
+.PHONY: cppcheck
+cppcheck:
+       cppcheck $(CPPCHECK) $$(awk -F= '/^CPPFLAGS|^INCLUDES/{print $$2}' <Makefile) .
+
 pharext/%: $(PECL_INI) php | $(srcdir)/../%.ext.phar
        for phar in $|; do $(bindir)/php $$phar --prefix=$(prefix) --ini=$(PECL_INI); done
diff --git a/cppcheck.suppressions b/cppcheck.suppressions
new file mode 100644 (file)
index 0000000..371c1d0
--- /dev/null
@@ -0,0 +1,3 @@
+*:*/zend_operators.h
+varFuncNullUB
+variableScope