From: Jean-Philippe Orsini Date: Tue, 25 Feb 2014 12:52:08 +0000 (+0000) Subject: added cppcheck X-Git-Tag: v1.3.0~16 X-Git-Url: https://git.wpitchoune.net/gitweb/?p=ppastats.git;a=commitdiff_plain;h=2a5acf4e9e701b60e600b86366687c267fb64d9d added cppcheck --- diff --git a/Makefile.in b/Makefile.in index 486e77f..625866c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -254,6 +254,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HAVE_CPPCHECK = @HAVE_CPPCHECK@ HELP2MAN = @HELP2MAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ diff --git a/configure b/configure index 4acb372..2e8f432 100755 --- a/configure +++ b/configure @@ -627,6 +627,7 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +HAVE_CPPCHECK HELP2MAN JSON_FALSE JSON_TRUE @@ -7131,6 +7132,44 @@ fi done +# Extract the first word of "cppcheck", so it can be a program name with args. +set dummy cppcheck; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAVE_CPPCHECK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_CPPCHECK"; then + ac_cv_prog_HAVE_CPPCHECK="$HAVE_CPPCHECK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_CPPCHECK="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +HAVE_CPPCHECK=$ac_cv_prog_HAVE_CPPCHECK +if test -n "$HAVE_CPPCHECK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_CPPCHECK" >&5 +$as_echo "$HAVE_CPPCHECK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure diff --git a/configure.ac b/configure.ac index aa5f46e..edd7106 100644 --- a/configure.ac +++ b/configure.ac @@ -60,4 +60,6 @@ AC_CONFIG_FILES([ po/Makefile.in AC_CHECK_PROGS([HELP2MAN], [help2man]) +AC_CHECK_PROG(HAVE_CPPCHECK, cppcheck, yes) + AC_OUTPUT diff --git a/src/Makefile.in b/src/Makefile.in index af1af11..fc721e1 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -215,6 +215,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HAVE_CPPCHECK = @HAVE_CPPCHECK@ HELP2MAN = @HELP2MAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ diff --git a/tests/Makefile.am b/tests/Makefile.am index cb62afe..a94900d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -4,10 +4,12 @@ check-local: checkpatch.pl EXTRA_DIST = \ checkpatch.pl \ + test-cppcheck.sh \ test_strrep.c \ test_ptime.c -TESTS = test-strrep \ +TESTS = test-cppcheck.sh \ + test-strrep \ test-ptime check_PROGRAMS = test-strrep test-ptime diff --git a/tests/Makefile.in b/tests/Makefile.in index e870bed..7991fca 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -77,7 +77,7 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -TESTS = test-strrep$(EXEEXT) test-ptime$(EXEEXT) +TESTS = test-cppcheck.sh test-strrep$(EXEEXT) test-ptime$(EXEEXT) check_PROGRAMS = test-strrep$(EXEEXT) test-ptime$(EXEEXT) subdir = tests DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ @@ -396,6 +396,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HAVE_CPPCHECK = @HAVE_CPPCHECK@ HELP2MAN = @HELP2MAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -494,6 +495,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = \ checkpatch.pl \ + test-cppcheck.sh \ test_strrep.c \ test_ptime.c @@ -829,6 +831,13 @@ recheck: all $(check_PROGRAMS) am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? +test-cppcheck.sh.log: test-cppcheck.sh + @p='test-cppcheck.sh'; \ + b='test-cppcheck.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) test-strrep.log: test-strrep$(EXEEXT) @p='test-strrep$(EXEEXT)'; \ b='test-strrep'; \ diff --git a/tests/test-cppcheck.sh b/tests/test-cppcheck.sh new file mode 100755 index 0000000..ef3ac2c --- /dev/null +++ b/tests/test-cppcheck.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +EIDS=performance,portability +ROOTDIR="$srcdir/.." +INCLUDE_OPTS="-q -f -I$ROOTDIR/src -I$ROOTDIR -I$ROOTDIR/.." + +cppcheck $ROOTDIR/src $INCLUDE_OPTS --enable=$EIDS --quiet --error-exitcode=1 || exit 1 diff --git a/www/Makefile.in b/www/Makefile.in index 919c232..4396bd8 100644 --- a/www/Makefile.in +++ b/www/Makefile.in @@ -170,6 +170,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HAVE_CPPCHECK = @HAVE_CPPCHECK@ HELP2MAN = @HELP2MAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@