2015-01-27 19:31:41 +01:00
|
|
|
#!/bin/bash
|
|
|
|
set -e # abort on error
|
2015-11-22 11:03:10 +01:00
|
|
|
set -x # be verbose
|
2015-01-27 19:31:41 +01:00
|
|
|
|
2016-12-25 00:43:47 +01:00
|
|
|
if [[ $(pwd) == */test/cfg ]] ; then # we are in test/cfg
|
2015-01-27 19:31:41 +01:00
|
|
|
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-10-18 17:00:09 +02:00
|
|
|
CXX_OPT='-fsyntax-only -std=c++0x -Wno-format -Wno-format-security'
|
2015-08-10 22:58:46 +02:00
|
|
|
CC=gcc
|
2015-10-01 20:18:06 +02:00
|
|
|
CC_OPT='-Wno-format -Wno-nonnull -Wno-implicit-function-declaration -Wno-deprecated-declarations -Wno-format-security -Wno-nonnull -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
|
|
|
|
|
2017-04-18 18:04:27 +02:00
|
|
|
# qt.cpp
|
|
|
|
${CXX} ${CXX_OPT} ${DIR}qt.cpp
|
2017-04-18 18:47:35 +02:00
|
|
|
${CPPCHECK} --enable=style --enable=information --inconclusive --inline-suppr --error-exitcode=1 --library=qt ${DIR}qt.cpp
|
2017-04-18 18:04:27 +02:00
|
|
|
|
2015-08-10 23:44:36 +02:00
|
|
|
# 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
|
2016-01-15 00:11:48 +01:00
|
|
|
${CPPCHECK} --check-library --enable=information --enable=style --error-exitcode=1 --inline-suppr --library=windows.cfg ${DIR}windows.cpp
|
2015-03-05 06:48:44 +01:00
|
|
|
|