Hans Joachim Desserud has proposed merging lp:~hjd/widelands/scan-build-script
into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~hjd/widelands/scan-build-script/+merge/173948
Adds a script to run scan-build static analyzer on the source code. Makes it
easier for others check out what it reports as well as reduces the bus count
factor for future reports.
Currently only supports Arch and Debian-based platforms as far as I know/have
tested, though I imagine it could easily be adapted to support more platforms.
The script does a small "feature-sniffing" check looking for a script called
c++-analyzer which is set as the compiler when later calling cmake. All this
check really do is check two locations, and if the script is found in either it
will attempt to use it.
Given that it finds the script in question, it will build widelands in the
temporary directory build/scan-build. After running, scan-build will tell you
how many issues it found and how to view the report.
Tested on Ubuntu 13.04 and Arch Linux.
--
https://code.launchpad.net/~hjd/widelands/scan-build-script/+merge/173948
Your team Widelands Developers is requested to review the proposed merge of
lp:~hjd/widelands/scan-build-script into lp:widelands.
=== added file 'utils/scan-build.sh'
--- utils/scan-build.sh 1970-01-01 00:00:00 +0000
+++ utils/scan-build.sh 2013-07-10 13:51:37 +0000
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+#Requirements:
+# scan-build/clang (obviously)
+# gcc (used on non-Darwin platforms)
+
+#Beware:
+# Running scan-build from llvm 3.2 will list a large number of false positives
+# ("Called C++ object pointer is null" and "Dereference of null pointer").
+# Running a newer version is recommended.
+
+if ! [ -d build ]; then
+ echo "This script should be run from the root directory."
+ exit 1
+fi
+
+if [ -e /usr/share/clang/scan-build/c++-analyzer ]; then
+ #Debian-based
+ ANALYZER=/usr/share/clang/scan-build/c++-analyzer
+elif [ -e /usr/lib/clang-analyzer/scan-build/c++-analyzer ]; then
+ #Arch
+ ANALYZER=/usr/lib/clang-analyzer/scan-build/c++-analyzer
+else
+ echo "Could not find c++-analyzer on your platform."
+ echo "We are currenly only able to locate it on Arch and Debian-based platforms."
+ echo "If you know where we could find it, please let us know."
+ exit 1
+fi
+
+BUILD_DIR=build/scan-build
+SOURCE_DIR=../..
+
+mkdir -p $BUILD_DIR
+cd $BUILD_DIR
+
+cmake $SOURCE_DIR -DCMAKE_CXX_COMPILER=$ANALYZER \
+ -DCMAKE_BUILD_TYPE=Debug \
+ -DWL_PORTABLE=true
+
+scan-build make
+
+#The output is stored in /tmp, doesn't need the actual build
+cd $SOURCE_DIR
+rm -r $BUILD_DIR
_______________________________________________
Mailing list: https://launchpad.net/~widelands-dev
Post to : [email protected]
Unsubscribe : https://launchpad.net/~widelands-dev
More help : https://help.launchpad.net/ListHelp