| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
set -u |
| 5 |
|
| 6 |
myself=`echo "$0" | sed 's,.*/,,'` |
| 7 |
|
| 8 |
say() |
| 9 |
{ |
| 10 |
echo "$myself: $@." |
| 11 |
} |
| 12 |
|
| 13 |
die() |
| 14 |
{ |
| 15 |
echo >&2 "$myself: $@." |
| 16 |
exit 1 |
| 17 |
} |
| 18 |
|
| 19 |
general_args='--analyze' |
| 20 |
include_args=' |
| 21 |
-I. |
| 22 |
-Ilib |
| 23 |
-Ilib/ev |
| 24 |
-Ilib/pidfile |
| 25 |
-Isrc/common |
| 26 |
-I/usr/local/include |
| 27 |
-I/usr/pkg/include' |
| 28 |
definition_args=' |
| 29 |
-DHAVE_CONFIG_H |
| 30 |
-DNSCA_VERSION=PACKAGE_VERSION |
| 31 |
-DSYSCONFDIR="/foo" |
| 32 |
-DLOCALSTATEDIR="/bar"' |
| 33 |
|
| 34 |
test -f 'lib/system.h' \ |
| 35 |
|| die 'Please call me from the NSCA-ng source directory' |
| 36 |
test -f 'config.h' \ |
| 37 |
|| die "Please run ./configure before calling $0" |
| 38 |
|
| 39 |
files=`find 'src' -type 'f' -name '*.c' -print` |
| 40 |
|
| 41 |
echo "Letting Clang analyze the following list of files:" |
| 42 |
echo |
| 43 |
echo "$files" |
| 44 |
echo |
| 45 |
|
| 46 |
exec clang $general_args $include_args $definition_args $files |