aboutsummaryrefslogtreecommitdiff
path: root/cmake/scripts/linux/clang-check-test.sh.in
blob: 12e9a0e62d525c8cbd1f1b7a537b0947f80e9296 (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
#!/bin/bash

# This script performs a single analysis using clang-check
# It is used by the 'make test' target in the buildsystems
# Usually you should use 'ctest -C clang-check' rather than calling this script directly
#
# Parameters: $1 = Application binary
#             $2 = Source file to process

clangcheck_cmd=$1
source_file=$2

tmpfil=`mktemp`
$clangcheck_cmd -p @CMAKE_BINARY_DIR@ -analyze $source_file &> $tmpfil
nerr=`cat $tmpfil | grep -v "warning: .*: 'linker' input unused" | wc -l`
if test $nerr -gt 0
then
  cat $tmpfil
  rm $tmpfil
  exit 1
fi

rm $tmpfil
exit 0