2015-01-27 19:31:41 +01:00
|
|
|
#!/bin/bash
|
|
|
|
set -e # abort on error
|
|
|
|
|
|
|
|
if [[ `pwd` == */test/cfg ]] ; then # we are in test/cfg
|
|
|
|
CPPCHECK="../../cppcheck"
|
|
|
|
DIR=""
|
|
|
|
else # assume we are in repo root
|
|
|
|
CPPCHECK="./cppcheck"
|
|
|
|
DIR=./test/cfg/
|
|
|
|
fi
|
|
|
|
|
2015-08-10 23:44:36 +02:00
|
|
|
# Cppcheck options
|
2015-08-14 01:36:44 +02:00
|
|
|
CPPCHECK_OPT='--check-library --enable=information --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr --template="{file}:{line}:{severity}:{id}:{message}"'
|
2015-08-10 23:44:36 +02:00
|
|
|
|
2015-08-10 22:58:46 +02:00
|
|
|
# Compiler settings
|
|
|
|
CXX=g++
|
2015-08-14 02:06:48 +02:00
|
|
|
CXX_OPT='-fsyntax-only -std=c++0x'
|
2015-08-10 22:58:46 +02:00
|
|
|
CC=gcc
|
2015-08-27 14:49:52 +02:00
|
|
|
CC_OPT='-Wno-nonnull -Wno-implicit-function-declaration -fsyntax-only'
|
2015-08-10 22:58:46 +02:00
|
|
|
|
2015-01-30 06:43:40 +01:00
|
|
|
# posix.c
|
2015-08-10 22:58:46 +02:00
|
|
|
${CC} ${CC_OPT} ${DIR}posix.c
|
2015-08-10 23:44:36 +02:00
|
|
|
${CPPCHECK} ${CPPCHECK_OPT} --library=posix ${DIR}posix.c
|
2015-02-16 22:19:51 +01:00
|
|
|
|
|
|
|
# gnu.c
|
2015-08-10 22:58:46 +02:00
|
|
|
${CC} ${CC_OPT} -D_GNU_SOURCE ${DIR}gnu.c
|
2015-08-10 23:44:36 +02:00
|
|
|
${CPPCHECK} ${CPPCHECK_OPT} --library=gnu ${DIR}gnu.c
|
|
|
|
|
|
|
|
# std.c
|
|
|
|
${CC} ${CC_OPT} ${DIR}std.c
|
|
|
|
${CPPCHECK} ${CPPCHECK_OPT} ${DIR}std.c
|
|
|
|
${CXX} ${CXX_OPT} ${DIR}std.cpp
|
|
|
|
${CPPCHECK} ${CPPCHECK_OPT} ${DIR}std.cpp
|
2015-01-30 06:43:40 +01:00
|
|
|
|
2015-03-05 06:48:44 +01:00
|
|
|
# windows.cpp
|
2015-08-10 22:58:46 +02:00
|
|
|
#${CXX} -fsyntax-only ${DIR}windows.cpp
|
2015-08-10 23:44:36 +02:00
|
|
|
${CPPCHECK} --check-library --enable=information --enable=style --error-exitcode=1 --inline-suppr --library=windows ${DIR}windows.cpp
|
2015-03-05 06:48:44 +01:00
|
|
|
|