aboutsummaryrefslogtreecommitdiff
path: root/travis/csa
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-02-06 22:18:23 +0100
committerEven Rouault <even.rouault@spatialys.com>2020-02-06 23:33:15 +0100
commit9e1420309c075ff1cc74514e39d0cf6da1e4e19c (patch)
tree396a0aba2b2e0203ef72857299dd2105960cba3c /travis/csa
parentbd6148db5f5b9a0a13f3dc2d2c35a066c15a57ed (diff)
downloadPROJ-9e1420309c075ff1cc74514e39d0cf6da1e4e19c.tar.gz
PROJ-9e1420309c075ff1cc74514e39d0cf6da1e4e19c.zip
Travis: update CLang Static Analyzer to CLang 9
Enable optional checkers Fix two false positives
Diffstat (limited to 'travis/csa')
-rwxr-xr-xtravis/csa/before_install.sh6
-rwxr-xr-xtravis/csa/install.sh29
2 files changed, 29 insertions, 6 deletions
diff --git a/travis/csa/before_install.sh b/travis/csa/before_install.sh
index dcb7733b..0ebc94fb 100755
--- a/travis/csa/before_install.sh
+++ b/travis/csa/before_install.sh
@@ -7,7 +7,7 @@ set -e
sudo apt-get install -qq sqlite3 libsqlite3-dev libtiff-dev libcurl4-openssl-dev
-CLANG_LLVM=clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04
-wget http://releases.llvm.org/6.0.0/$CLANG_LLVM.tar.xz
+CLANG_LLVM=clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04
+wget http://releases.llvm.org/9.0.0/$CLANG_LLVM.tar.xz
tar xJf $CLANG_LLVM.tar.xz
-mv $CLANG_LLVM clang+llvm-6
+mv $CLANG_LLVM clang+llvm-9
diff --git a/travis/csa/install.sh b/travis/csa/install.sh
index 334389ee..349afcb1 100755
--- a/travis/csa/install.sh
+++ b/travis/csa/install.sh
@@ -5,7 +5,30 @@ set -e
# prepare build files
./autogen.sh
-CXXFLAGS="-std=c++11" ./clang+llvm-6/bin/scan-build -o scanbuildoutput -plist -v ./configure
-./clang+llvm-6/bin/scan-build -o scanbuildoutput -plist -v make -j2
+export PATH=$PWD/clang+llvm-9/bin:$PATH
+CXXFLAGS="-std=c++11" scan-build -o scanbuildoutput -plist -v ./configure
+rm -rf scanbuildoutput
+TOPDIR=$PWD
+scan-build -o $TOPDIR/scanbuildoutput -sarif -v -enable-checker alpha.unix.cstring.OutOfBounds,alpha.unix.cstring.BufferOverlap,optin.cplusplus.VirtualCall,optin.cplusplus.UninitializedObject make -j2
-if grep -r "\.c" scanbuildoutput | grep "<string>" | grep -v -e "<key>" -e _generated_parser; then echo "error" && /bin/false; else echo "ok"; fi
+sudo apt-get install jq
+
+rm -f filtered_scanbuild.txt
+files=$(find scanbuildoutput -name "*.sarif")
+for f in $files; do
+ jq '.runs[].results[] | (if .locations[].physicalLocation.fileLocation.uri | (contains("_generated_parser") ) then empty else { "uri": .locations[].physicalLocation.fileLocation.uri, "msg": .message.text, "location": .codeFlows[-1].threadFlows[-1].locations[-1] } end)' < $f > tmp.txt
+ if [ -s tmp.txt ]; then
+ echo "Errors from $f: "
+ cat $f
+ echo ""
+ cat tmp.txt >> filtered_scanbuild.txt
+ fi
+done
+if [ -s filtered_scanbuild.txt ]; then
+ echo ""
+ echo ""
+ echo "========================"
+ echo "Summary of errors found:"
+ cat filtered_scanbuild.txt
+ /bin/false
+fi