[ooo-build-commit] .: 2 commits - bin/cws-extract bin/mkcppcheck.sh Makefile.shared

Thorsten Behrens thorsten at kemper.freedesktop.org
Wed Apr 14 04:24:41 PDT 2010


 Makefile.shared   |    5 ++++
 bin/cws-extract   |    4 +--
 bin/mkcppcheck.sh |   64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 71 insertions(+), 2 deletions(-)

New commits:
commit 660018614680a9b879046880ab4ec2df74228c95
Author: Thorsten Behrens <thb at openoffice.org>
Date:   Wed Apr 14 13:16:01 2010 +0200

    Added preliminary cppcheck support
    
    "Cppcheck is an analysis tool for C/C++ code. Unlike C/C++ compilers
     and many other analysis tools, we don't detect syntax errors.
     Cppcheck only detects the types of bugs that the compilers normally
     fail to detect. The goal is no false positives."
    
    * Makefile.shared: added 'cppcheck' target
    * bin/mkcppcheck.sh: the wrapper script.

diff --git a/Makefile.shared b/Makefile.shared
index a4e1456..e80ac3f 100644
--- a/Makefile.shared
+++ b/Makefile.shared
@@ -139,6 +139,10 @@ docs: $(BUILDDIR)/docs/index.html
 $(BUILDDIR)/docs/index.html: $(STAMP_DIR)/build
 	cd $(OOBUILDDIR); $(TOOLSDIR)/bin/mkdocs.sh $(BUILDDIR)/docs $(TOOLSDIR)/bin/doxygen.cfg
 
+cppcheck: $(STAMP_DIR)/build.cppcheck
+$(STAMP_DIR)/build.cppcheck: $(STAMP_DIR)/build
+	cd $(OOBUILDDIR); $(TOOLSDIR)/bin/mkcppcheck.sh -s -j $(BUILD_NCPUS)
+
 gitignore : $(OOBUILDDIR)/.gitignore
 $(OOBUILDDIR)/.gitignore : $(OOBUILDDIR)/unpack
 	cd $(OOBUILDDIR); $(TOOLSDIR)/bin/create-gitignores.sh
@@ -160,6 +164,7 @@ help:
 	@echo "    * id:              generates the GNU ID database"
 	@echo "    * tags:            generates the tags file"
 	@echo "    * docs:            generates (partial) doxygen src docs"
+	@echo "    * cppcheck:        run cppcheck over (most of) the source tree"
 	@echo "    * gitignore:       creates the default .gitignore file in the unpacked sources"
 	@echo "    * smoketest:       runs the automated tests"
 	@echo "    * patch.apply:     applies the patches to the sources"
diff --git a/bin/mkcppcheck.sh b/bin/mkcppcheck.sh
new file mode 100755
index 0000000..68f4792
--- /dev/null
+++ b/bin/mkcppcheck.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# run cppcheck
+#
+
+## subroutines
+usage ()
+{
+	echo "Usage: $0 [options]"
+	echo "Options:"
+	echo "-j <N>     number of parallel jobs to start"
+	echo "-u         try to detect unused function (mutually exclusive to -j)"
+	echo "-s         moan about stylistic problems, too"
+	echo "-h         this help"
+}
+
+## code
+NCPUS=1
+while getopts hsuj: opt ; do
+	case "$opt" in
+		j) NCPUS="$OPTARG" ;;
+		s) STYLE="--style" ;;
+		u) REPORT_UNUSED="--unused-functions" ;;
+		h) usage; exit ;;
+		?) usage; exit ;;
+	esac
+done
+
+# binaries that we need
+which cppcheck > /dev/null 2>&1 || {
+    echo "You need cppcheck for this"
+	exit 1
+}
+
+# otherwise, aliases are not expanded below
+shopt -s expand_aliases
+
+# suck setup
+BINDIR=`dirname $0`
+. $BINDIR/setup
+
+. ./*.Set.sh
+
+# get list of modules in build order
+INPUT_PROJECTS=`cd instsetoo_native && build --all --show | sed -n -e '/Building module/ s/Building module // p'`
+
+# strip -I. and bin -I prefix; exlude system headers
+INCLUDE_PATH=`echo $SOLARINC | sed -e ' s/-I\.//'g | sed -e ' s/ -I/ /'g | sed -e ' s|/usr/[^ ]*| |g'`
+
+
+###################################################
+#
+# run cppcheck, separately for each module
+#
+###################################################
+
+for PROJECT in $INPUT_PROJECTS; 
+do
+  echo "Checking module $PROJECT"
+  cppcheck -j$NCPUS $REPORT_UNUSED -v $STYLE $SOLARINC -I$PROJECT/inc -I$PROJECT/inc/pch $PROJECT/source
+  echo
+done
+
+## done
commit 1b28d9da9fc205ef8398468c64a44a556012cec9
Author: Thorsten Behrens <thb at openoffice.org>
Date:   Wed Apr 14 12:59:15 2010 +0200

    Specify reference master explicitely for cws-extract
    
    * bin/cws-extract:

diff --git a/bin/cws-extract b/bin/cws-extract
index eb0158d..67be5d0 100755
--- a/bin/cws-extract
+++ b/bin/cws-extract
@@ -49,7 +49,7 @@ sub cws_extract($$$)
 {
     my ( $mws, $cws, $bundle ) = @_;
 
-    my $milestone = `cws query -c $cws current 2>> .log | tail -n 1`;
+    my $milestone = `cws query -M $mws -c $cws current 2>> .log | tail -n 1`;
     $milestone =~ s/\n//g;
 
 	if (not -d $mws or not -d "$mws/.hg") {
@@ -63,7 +63,7 @@ sub cws_extract($$$)
         exit 1;
     }
 
-    print "MWS:\t\tupdating to $milestone\n";
+    print "MWS:\t\tupdating to milestone: $milestone\n";
     if ( system( "cd $mws && \
                   hg checkout ${mws}_${milestone}" ) != 0 ) {
         print STDERR "Unable to checkout suitable milestone, check the log for details.\n";


More information about the ooo-build-commit mailing list