diff --git a/cfg/wxwidgets.cfg b/cfg/wxwidgets.cfg index 34c496ad7..692e2b32e 100644 --- a/cfg/wxwidgets.cfg +++ b/cfg/wxwidgets.cfg @@ -84,8 +84,15 @@ + + + + false + + + - + false @@ -98,7 +105,7 @@ - + false @@ -111,7 +118,7 @@ - + false @@ -124,9 +131,10 @@ - + - false + + true @@ -137,7 +145,7 @@ - + false @@ -149,8 +157,23 @@ + + + + + + false + + + + + + + + + - + false @@ -163,7 +186,7 @@ - + false @@ -176,11 +199,14 @@ - + false + + + @@ -188,6 +214,19 @@ + + + + false + + + + + + + + + @@ -595,7 +634,6 @@ false - @@ -665,18 +703,13 @@ - - false - - - false - + @@ -823,11 +856,11 @@ - + + false - @@ -897,6 +930,110 @@ + + + + false + + + + + + + + + + + + + + + false + + + + + + + + + + + false + + + + + + + + + + + + + false + + + + + + + false + + + + + + + + + + false + + + + + + + + + + + + + false + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + @@ -1067,6 +1204,9 @@ + + + @@ -1084,4 +1224,5 @@ + diff --git a/test/cfg/runtests.sh b/test/cfg/runtests.sh index 252f60d22..878a90fd1 100755 --- a/test/cfg/runtests.sh +++ b/test/cfg/runtests.sh @@ -43,3 +43,8 @@ ${CPPCHECK} ${CPPCHECK_OPT} ${DIR}std.cpp ${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 + +# wxwidgets.cpp +# Syntax check via g++ is disabled because wx headers are not always present. +#${CXX} ${CXX_OPT} ${DIR}wxwidgets.cpp +${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --library=wxwidgets ${DIR}wxwidgets.cpp diff --git a/test/cfg/wxwidgets.cpp b/test/cfg/wxwidgets.cpp new file mode 100644 index 000000000..1e802b91e --- /dev/null +++ b/test/cfg/wxwidgets.cpp @@ -0,0 +1,60 @@ + +// Test library configuration for windows.cfg +// +// Usage: +// $ cppcheck --check-library --library=windows --enable=information --error-exitcode=1 --inline-suppr --suppress=missingIncludeSystem test/cfg/windows.cpp +// => +// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0 +// + +#include + +void validCode() +{ + wxString str = wxGetCwd(); + + wxLogGeneric(wxLOG_Message, "test %d", 0); + wxLogMessage("test %s", "str"); + + wxSpinCtrl::SetBase(10); + wxSpinCtrl::SetBase(16); + + wxString translation1 = _("text"); + wxString translation2 = wxGetTranslation("text"); + wxString translation3 = wxGetTranslation("string", "domain"); +} + +void nullPointer() +{ + // cppcheck-suppress nullPointer + wxLogGeneric(wxLOG_Message, NULL); + // cppcheck-suppress nullPointer + wxLogMessage(NULL); +} + +void ignoredReturnValue() +{ + // cppcheck-suppress ignoredReturnValue + wxGetCwd(); +} + +void invalidFunctionArg() +{ + // cppcheck-suppress invalidFunctionArg + wxSpinCtrl::SetBase(0); + // cppcheck-suppress invalidFunctionArg + wxSpinCtrl::SetBase(5); +} + +void uninitvar() +{ + wxLogLevel logLevelUninit; + char cBufUninit[10]; + char *pcUninit; + // cppcheck-suppress uninitvar + wxLogGeneric(logLevelUninit, "test"); + // cppcheck-suppress uninitvar + wxLogMessage(cBufUninit); + // cppcheck-suppress uninitvar + wxLogMessage(pcUninit); +}