summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/dist/s_clang-scan
blob: 33d6f3e7d9eb63f22776b33d9af928cb8d87bb08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /bin/sh

t=__wt.$$
trap 'rm -rf $t /tmp/scan-build-*' 0 1 2 3 13 15

# Installation of the clang development package isn't standard, list a
# couple of the places we're using.
export PATH=$PATH:/usr/local/clang50/bin:/usr/local/llvm-devel/bin

# Remove old reports.
rm -rf /tmp/scan-build-*

# Find the top-level WiredTiger directory and move to there.
p="$PWD"
while test "$p" != "/" ; do
	if test -d "$p/build_posix"; then
		break;
	fi
	p=`dirname $p`
done
test "$p" != "/" || {
	echo "$0: cannot find the WiredTiger top-level directory"
	exit 1
}

cd $p || exit 1
echo "$0: running scan-build in $p..."

sh autogen.sh > /dev/null || exit 1

args="--use-cc=clang40 -no-failure-reports"
args="$args -disable-checker core.NullDereference"
scan-build $args ./configure 'CFLAGS=-g -Wall' \
    --disable-shared --enable-diagnostic --enable-strict > /dev/null
scan-build $args make -j 8 wt 2>&1 > $t

make -j 8 distclean > /dev/null

grep 'No bugs found' $t > /dev/null || {
	echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
	echo 'unexpected scan-build output'
	echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
	sed -e '/^--- /d' \
	    -e '/^\/bin\/sh /d' \
	    -e '/^depbase=/d' \
	    -e '/^libtool: /d' < $t
	exit 1
}

exit 0