[Asterisk-code-review] Example script to run clang-scan-build (static analyzer) (asterisk[13])

Diederik de Groot asteriskteam at digium.com
Mon Apr 20 07:59:31 CDT 2015


Diederik de Groot has uploaded a new change for review.

  https://gerrit.asterisk.org/158

Change subject: Example script to run clang-scan-build (static analyzer)
......................................................................

Example script to run clang-scan-build (static analyzer)

Change-Id: I70405fe54e4be7dbfbcb62e291690069b88617a8
---
A contrib/scripts/clang-scan-build
1 file changed, 19 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/58/158/1

diff --git a/contrib/scripts/clang-scan-build b/contrib/scripts/clang-scan-build
new file mode 100644
index 0000000..8910630
--- /dev/null
+++ b/contrib/scripts/clang-scan-build
@@ -0,0 +1,19 @@
+#!/bin/bash
+SCANBUILD="scan-build"
+if [ -z "`which clang`" ]; then
+	CCC_CC="clang"
+	CCC_CXX="clang++"
+	CFLAGS="-fblocks"
+else
+	CCC_CC="gcc"
+	CCC_CXX="g++"
+	CFLAGS=""
+fi
+
+SCANBUILD_FLAGS="-maxloop 10 -disable-checker deadcode.DeadStores -enable-checker alpha.core.BoolAssignment -enable-checker alpha.core.CallAndMessageUnInitRefArg -enable-checker alpha.core.CastSize -enable-checker alpha.core.CastToStruct -enable-checker alpha.core.IdenticalExpr -enable-checker alpha.core.PointerArithm -enable-checker alpha.core.PointerSub -enable-checker alpha.core.SizeofPtr -enable-checker alpha.core.TestAfterDivZero -enable-checker alpha.security.ArrayBound -enable-checker alpha.security.ArrayBoundV2 -enable-checker alpha.security.MallocOverflow -enable-checker alpha.security.ReturnPtrRange -enable-checker alpha.security.taint.TaintPropagation -enable-checker alpha.unix.MallocWithAnnotations -enable-checker alpha.unix.PthreadLock -enable-checker alpha.unix.SimpleStream -enable-checker alpha.unix.Stream -enable-checker alpha.unix.cstring.BufferOverlap -enable-checker alpha.unix.cstring.NotNullTerminated -enable-checker alpha.unix.cstring.OutOfBounds"
+
+${SCANBUILD} ${SCANBUILD_FLAGS} -o scanbuild-output ./configure --enable-coverage --disable-xmldoc $*
+if [ $? == 0 ]; then
+	make clean
+	${SCANBUILD} ${SCANBUILD_FLAGS} -o scanbuild-output make
+fi

-- 
To view, visit https://gerrit.asterisk.org/158
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I70405fe54e4be7dbfbcb62e291690069b88617a8
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Diederik de Groot <dkgroot at talon.nl>



More information about the asterisk-code-review mailing list