"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/cfg/runtests.sh" between
cppcheck-1.86.tar.gz and cppcheck-1.87.tar.gz

About: Cppcheck is a static analysis tool for C/C++ code. It checks for memory leaks, mismatching allocation-deallocation, buffer overrun, and many more.

runtests.sh  (cppcheck-1.86):runtests.sh  (cppcheck-1.87)
#!/bin/bash #!/bin/bash
set -e # abort on error set -e # abort on error
set -x # be verbose #set -x # be verbose
if [[ $(pwd) == */test/cfg ]] ; then # we are in test/cfg if [[ $(pwd) == */test/cfg ]] ; then # we are in test/cfg
CPPCHECK="../../cppcheck" CPPCHECK="../../cppcheck"
DIR="" DIR=""
CFG="../../cfg/" CFG="../../cfg/"
else # assume we are in repo root else # assume we are in repo root
CPPCHECK="./cppcheck" CPPCHECK="./cppcheck"
DIR=test/cfg/ DIR=test/cfg/
CFG="cfg/" CFG="cfg/"
fi fi
# Cppcheck options # Cppcheck options
CPPCHECK_OPT='--check-library --enable=information --enable=style --error-exitco de=-1 --suppress=missingIncludeSystem --inline-suppr --template="{file}:{line}:{ severity}:{id}:{message}"' CPPCHECK_OPT='--check-library --enable=information --enable=style --error-exitco de=-1 --suppress=missingIncludeSystem --inline-suppr --template="{file}:{line}:{ severity}:{id}:{message}"'
# Compiler settings # Compiler settings
CXX=g++ CXX=g++
CXX_OPT='-fsyntax-only -std=c++0x -Wno-format -Wno-format-security' CXX_OPT='-fsyntax-only -std=c++0x -Wno-format -Wno-format-security'
CC=gcc CC=gcc
CC_OPT='-Wno-format -Wno-nonnull -Wno-implicit-function-declaration -Wno-depreca ted-declarations -Wno-format-security -Wno-nonnull -fsyntax-only' CC_OPT='-Wno-format -Wno-nonnull -Wno-implicit-function-declaration -Wno-depreca ted-declarations -Wno-format-security -Wno-nonnull -fsyntax-only'
# Verify that unmatchedSuppression messages result in an error code
set +e
${CPPCHECK} ${CPPCHECK_OPT} ${DIR}unmatchedSuppressionTest.c
CPPCHECK_RETURNCODE=$?
set -e
if [ ${CPPCHECK_RETURNCODE} -eq 0 ]; then
echo "Error: unmatchedSuppression must result in an exit code signaling an e
rror!"
exit 1
fi
# posix.c # posix.c
${CC} ${CC_OPT} ${DIR}posix.c ${CC} ${CC_OPT} ${DIR}posix.c
${CPPCHECK} ${CPPCHECK_OPT} --library=posix ${DIR}posix.c ${CPPCHECK} ${CPPCHECK_OPT} --library=posix ${DIR}posix.c
# gnu.c # gnu.c
${CC} ${CC_OPT} -D_GNU_SOURCE ${DIR}gnu.c ${CC} ${CC_OPT} -D_GNU_SOURCE ${DIR}gnu.c
${CPPCHECK} ${CPPCHECK_OPT} --library=gnu ${DIR}gnu.c ${CPPCHECK} ${CPPCHECK_OPT} --library=gnu ${DIR}gnu.c
# qt.cpp # qt.cpp
${CXX} ${CXX_OPT} ${DIR}qt.cpp set +e
${CPPCHECK} --enable=style --enable=information --inconclusive --inline-suppr -- pkg-config --version
error-exitcode=1 --library=qt ${DIR}qt.cpp PKGCONFIG_RETURNCODE=$?
set -e
if [ $PKGCONFIG_RETURNCODE -ne 0 ]; then
echo "pkg-config needed to retrieve Qt configuration is not available, skipp
ing syntax check."
else
set +e
QTCONFIG=$(pkg-config --cflags Qt5Core)
QTCONFIG_RETURNCODE=$?
set -e
if [ $QTCONFIG_RETURNCODE -eq 0 ]; then
QTBUILDCONFIG=$(pkg-config --variable=qt_config Qt5Core)
[[ $QTBUILDCONFIG =~ (^|[[:space:]])reduce_relocations($|[[:space:]]) ]]
&& QTCONFIG="${QTCONFIG} -fPIC"
set +e
echo -e "#include <QString>" | ${CXX} ${CXX_OPT} ${QTCONFIG} -x c++ -
QTCHECK_RETURNCODE=$?
set -e
if [ $QTCHECK_RETURNCODE -ne 0 ]; then
echo "Qt not completely present or not working, skipping syntax chec
k with ${CXX}."
else
echo "Qt found and working, checking syntax with ${CXX} now."
${CXX} ${CXX_OPT} ${QTCONFIG} ${DIR}qt.cpp
fi
fi
fi
${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --library=qt ${DIR}qt.cpp
# bsd.c # bsd.c
${CPPCHECK} ${CPPCHECK_OPT} --library=bsd ${DIR}bsd.c ${CPPCHECK} ${CPPCHECK_OPT} --library=bsd ${DIR}bsd.c
# std.c # std.c
${CC} ${CC_OPT} ${DIR}std.c ${CC} ${CC_OPT} ${DIR}std.c
${CPPCHECK} ${CPPCHECK_OPT} ${DIR}std.c ${CPPCHECK} ${CPPCHECK_OPT} ${DIR}std.c
${CXX} ${CXX_OPT} ${DIR}std.cpp ${CXX} ${CXX_OPT} ${DIR}std.cpp
${CPPCHECK} ${CPPCHECK_OPT} ${DIR}std.cpp ${CPPCHECK} ${CPPCHECK_OPT} ${DIR}std.cpp
# windows.cpp # windows.cpp
# Syntax check via g++ does not work because it can not find a valid windows.h # Syntax check via g++ does not work because it can not find a valid windows.h
#${CXX} ${CXX_OPT} ${DIR}windows.cpp #${CXX} ${CXX_OPT} ${DIR}windows.cpp
${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win32A ${DIR}windows.cpp ${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win32A ${DIR}windows.cpp
${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win32W ${DIR}windows.cpp ${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win32W ${DIR}windows.cpp
${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win64 ${DIR}windows.cpp ${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win64 ${DIR}windows.cpp
# wxwidgets.cpp # wxwidgets.cpp
set +e set +e
WXCONFIG=`wx-config --cxxflags` WXCONFIG=$(wx-config --cxxflags)
WXCONFIG_RETURNCODE=$? WXCONFIG_RETURNCODE=$?
set -e set -e
if [ $WXCONFIG_RETURNCODE -ne 0 ]; then if [ $WXCONFIG_RETURNCODE -ne 0 ]; then
echo "wx-config does not work, skipping syntax check for wxWidgets tests." echo "wx-config does not work, skipping syntax check for wxWidgets tests."
else else
set +e set +e
echo -e "#include <wx/filefn.h>\n#include <wx/app.h>\n#include <wx/artprov.h >\n#include <wx/version.h>\n#if wxVERSION_NUMBER<2950\n#error \"Old version\"\n# endif" | ${CXX} ${CXX_OPT} ${WXCONFIG} -x c++ - echo -e "#include <wx/filefn.h>\n#include <wx/app.h>\n#include <wx/artprov.h >\n#include <wx/version.h>\n#if wxVERSION_NUMBER<2950\n#error \"Old version\"\n# endif" | ${CXX} ${CXX_OPT} ${WXCONFIG} -x c++ -
WXCHECK_RETURNCODE=$? WXCHECK_RETURNCODE=$?
set -e set -e
if [ $WXCHECK_RETURNCODE -ne 0 ]; then if [ $WXCHECK_RETURNCODE -ne 0 ]; then
skipping to change at line 106 skipping to change at line 141
if [ $GTKCHECK_RETURNCODE -ne 0 ]; then if [ $GTKCHECK_RETURNCODE -ne 0 ]; then
echo "GTK+ not completely present or not working, skipping syntax ch eck with ${CXX}." echo "GTK+ not completely present or not working, skipping syntax ch eck with ${CXX}."
else else
echo "GTK+ found and working, checking syntax with ${CXX} now." echo "GTK+ found and working, checking syntax with ${CXX} now."
${CC} ${CC_OPT} ${GTKCONFIG} ${DIR}gtk.c ${CC} ${CC_OPT} ${GTKCONFIG} ${DIR}gtk.c
fi fi
fi fi
fi fi
${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --library=gtk -f ${DIR}gtk.c ${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --library=gtk -f ${DIR}gtk.c
# boost.cpp
set +e
echo -e "#include <boost/config.hpp>" | ${CXX} ${CXX_OPT} -x c++ -
BOOSTCHECK_RETURNCODE=$?
set -e
if [ ${BOOSTCHECK_RETURNCODE} -ne 0 ]; then
echo "Boost not completely present or not working, skipping syntax check wit
h ${CXX}."
else
echo "Boost found and working, checking syntax with ${CXX} now."
${CXX} ${CXX_OPT} ${DIR}boost.cpp
fi
${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --library=boost ${DIR}boost.cpp
# Check the syntax of the defines in the configuration files # Check the syntax of the defines in the configuration files
set +e set +e
xmlstarlet --version xmlstarlet --version
XMLSTARLET_RETURNCODE=$? XMLSTARLET_RETURNCODE=$?
set -e set -e
if [ $XMLSTARLET_RETURNCODE -ne 0 ]; then if [ $XMLSTARLET_RETURNCODE -ne 0 ]; then
echo "xmlstarlet needed to extract defines, skipping defines check." echo "xmlstarlet needed to extract defines, skipping defines check."
else else
for configfile in ${CFG}*.cfg; do for configfile in ${CFG}*.cfg; do
echo "Checking defines in $configfile" echo "Checking defines in $configfile"
# Disable debugging output temporarily since there could be many defines # Disable debugging output temporarily since there could be many defines
set +x set +x
# XMLStarlet returns 1 if no elements were found which is no problem her e # XMLStarlet returns 1 if no elements were found which is no problem her e
set +e set +e
EXTRACTED_DEFINES=$(xmlstarlet sel -t -m '//define' -c . -n <$configfile ) EXTRACTED_DEFINES=$(xmlstarlet sel -t -m '//define' -c . -n <$configfile )
set -e set -e
EXTRACTED_DEFINES=$(echo "$EXTRACTED_DEFINES" | sed 's/<define name="/#d efine /g' | sed 's/" value="/ /g' | sed 's/"\/>//g') EXTRACTED_DEFINES=$(echo "$EXTRACTED_DEFINES" | sed 's/<define name="/#d efine /g' | sed 's/" value="/ /g' | sed 's/"\/>//g')
echo "$EXTRACTED_DEFINES" | gcc -fsyntax-only -xc -Werror - echo "$EXTRACTED_DEFINES" | gcc -fsyntax-only -xc -Werror -
set -x
done done
fi fi
echo SUCCESS
 End of changes. 7 change blocks. 
6 lines changed or deleted 57 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)