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"
|
2018-01-10 15:52:06 +01:00
|
|
|
DIR=test/cfg/
|
2015-01-27 19:31:41 +01:00
|
|
|
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
|
|
|
|
2018-01-24 20:05:16 +01:00
|
|
|
# windows.cpp
|
|
|
|
# Syntax check via g++ does not work because it can not find a valid windows.h
|
|
|
|
#${CXX} ${CXX_OPT} ${DIR}windows.cpp
|
windows library: Add function configurations with tests (#1079)
Add function configurations with tests for:
GetLocalTime, GetSystemTime, GetLastError, SetLastError,
AllocateAndInitializeSid, FreeSid, HeapAlloc, HeapReAlloc, HeapFree,
HeapSize, HeapValidate and GetProcessHeap.
test/cfg/runtests.sh: Enable --inconclusive for the windows tests to
avoid some issues in the future.
2018-02-02 11:28:54 +01:00
|
|
|
${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win32A ${DIR}windows.cpp
|
|
|
|
${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win32W ${DIR}windows.cpp
|
|
|
|
${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win64 ${DIR}windows.cpp
|
2018-02-06 15:33:45 +01:00
|
|
|
|
|
|
|
# wxwidgets.cpp
|
2018-02-09 20:34:15 +01:00
|
|
|
set +e
|
|
|
|
WXCONFIG=`wx-config --cxxflags`
|
|
|
|
WXCONFIG_RETURNCODE=$?
|
|
|
|
set -e
|
|
|
|
if [ $WXCONFIG_RETURNCODE -ne 0 ]; then
|
|
|
|
echo "wx-config does not work, skipping syntax check for wxWidgets tests."
|
|
|
|
else
|
|
|
|
set +e
|
|
|
|
echo -e "#include <wx/filefn.h>\n#include <wx/app.h>\n#include <wx/artprov.h>\n" | ${CXX} ${CXX_OPT} ${WXCONFIG} -x c++ -
|
|
|
|
WXCHECK_RETURNCODE=$?
|
|
|
|
set -e
|
|
|
|
if [ $WXCHECK_RETURNCODE -ne 0 ]; then
|
|
|
|
echo "wxWidgets not completely present (with GUI classes) or not working, skipping syntax check with ${CXX}."
|
|
|
|
else
|
|
|
|
echo "wxWidgets found, checking syntax with ${CXX} now."
|
|
|
|
${CXX} ${CXX_OPT} ${WXCONFIG} -Wno-deprecated-declarations ${DIR}wxwidgets.cpp
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --library=wxwidgets -f ${DIR}wxwidgets.cpp
|