Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ Library::Error Library::loadFunction(const tinyxml2::XMLElement * const node, co
if (name.empty())
return Error(ErrorCode::OK);

// TODO: write debug warning if we modify an existing entry
Function& func = functions[name];

for (const tinyxml2::XMLElement *functionnode = node->FirstChildElement(); functionnode; functionnode = functionnode->NextSiblingElement()) {
Expand Down
53 changes: 26 additions & 27 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ if (BUILD_TESTS)
endforeach()

function(add_cfg CFG_TEST)
set(options INCONCLUSIVE)
set(oneValueArgs PLATFORM NAME)
set(multiValueArgs LIBRARY)
set(multiValueArgs ADD_LIBRARY)

cmake_parse_arguments(PARSE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(PARSE_LIBRARY)
string(REPLACE ";" "," LIBRARY "${PARSE_LIBRARY}")
else()
get_filename_component(LIBRARY ${CFG_TEST} NAME_WE)
get_filename_component(LIBRARY ${CFG_TEST} NAME_WE)
# TODO: get rid of this
if(PARSE_ADD_LIBRARY)
string(REPLACE ";" "," ADD_LIBRARY "${PARSE_ADD_LIBRARY}")
set(LIBRARY "${ADD_LIBRARY},${LIBRARY}")
endif()
set(PLATFORM unix64)
if(PARSE_PLATFORM)
Expand All @@ -107,10 +107,6 @@ if (BUILD_TESTS)
else()
string(MAKE_C_IDENTIFIER ${CFG_TEST} TEST_NAME)
endif()
set(INCONCLUSIVE)
if(PARSE_INCONCLUSIVE)
set(INCONCLUSIVE "--inconclusive")
endif()
if ("cfg-${TEST_NAME}" IN_LIST SKIP_TESTS)
else()
# TODO: add syntax check
Expand All @@ -119,24 +115,27 @@ if (BUILD_TESTS)
--check-library
--platform=${PLATFORM}
--library=${LIBRARY}
--enable=information
--enable=style
--enable=style,information
--inconclusive
--force
--error-exitcode=1
--suppress=missingIncludeSystem
--inline-suppr
${INCONCLUSIVE}
${CMAKE_CURRENT_SOURCE_DIR}/cfg/${CFG_TEST}
)
endif()
endfunction()
add_cfg(boost.cpp INCONCLUSIVE)
# TODO: glob this
add_cfg(boost.cpp)
add_cfg(bsd.c)
add_cfg(cairo.c)
add_cfg(cppunit.cpp INCONCLUSIVE)
add_cfg(gnu.c LIBRARY posix;gnu)
add_cfg(googletest.cpp INCONCLUSIVE)
add_cfg(gtk.c INCONCLUSIVE)
add_cfg(kde.cpp INCONCLUSIVE)
add_cfg(cppunit.cpp)
# TODO: posix needs to specified first or it has a different mmap() config
# TODO: get rid of posix dependency
add_cfg(gnu.c ADD_LIBRARY posix)
add_cfg(googletest.cpp)
add_cfg(gtk.c)
add_cfg(kde.cpp)
add_cfg(libcurl.c)
add_cfg(libsigc++.cpp)
add_cfg(lua.c)
Expand All @@ -145,14 +144,14 @@ if (BUILD_TESTS)
add_cfg(openssl.c)
add_cfg(posix.c)
add_cfg(python.c)
add_cfg(qt.cpp INCONCLUSIVE)
add_cfg(sqlite3.c INCONCLUSIVE)
add_cfg(std.c INCONCLUSIVE)
add_cfg(std.cpp INCONCLUSIVE)
add_cfg(windows.cpp INCONCLUSIVE NAME windows32A PLATFORM win32A)
add_cfg(windows.cpp INCONCLUSIVE NAME windows32W PLATFORM win32W)
add_cfg(windows.cpp INCONCLUSIVE NAME windows64 PLATFORM win64)
add_cfg(wxwidgets.cpp INCONCLUSIVE)
add_cfg(qt.cpp)
add_cfg(sqlite3.c)
add_cfg(std.c)
add_cfg(std.cpp)
add_cfg(windows.cpp NAME windows32A PLATFORM win32A)
add_cfg(windows.cpp NAME windows32W PLATFORM win32W)
add_cfg(windows.cpp NAME windows64 PLATFORM win64)
add_cfg(wxwidgets.cpp)

function(fixture_cost NAME COST)
if(TEST ${NAME})
Expand Down
2 changes: 1 addition & 1 deletion test/cfg/boost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for boost.cfg
//
// Usage:
// $ cppcheck --check-library --library=boost --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/boost.cpp
// $ cppcheck --check-library --library=boost --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/boost.cpp
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
2 changes: 1 addition & 1 deletion test/cfg/bsd.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Test library configuration for bsd.cfg
//
// Usage:
// $ cppcheck --check-library --library=bsd --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/bsd.c
// $ cppcheck --check-library --library=bsd --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/bsd.c
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
2 changes: 1 addition & 1 deletion test/cfg/cairo.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for cairo.cfg
//
// Usage:
// $ cppcheck --check-library --library=cairo --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/cairo.c
// $ cppcheck --check-library --library=cairo --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/cairo.c
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
2 changes: 1 addition & 1 deletion test/cfg/cppunit.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Test library configuration for cppunit.cfg
//
// Usage:
// $ cppcheck --check-library --library=cppunit --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/cppunit.cpp
// $ cppcheck --check-library --library=cppunit --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/cppunit.cpp
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
2 changes: 1 addition & 1 deletion test/cfg/gnu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for gnu.cfg
//
// Usage:
// $ cppcheck --check-library --library=gnu --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/gnu.c
// $ cppcheck --check-library --library=gnu --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/gnu.c
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
2 changes: 1 addition & 1 deletion test/cfg/googletest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for googletest.cfg
//
// Usage:
// $ cppcheck --check-library --library=googletest --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/googletest.cpp
// $ cppcheck --check-library --library=googletest --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/googletest.cpp
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
2 changes: 1 addition & 1 deletion test/cfg/gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for gtk.cfg
//
// Usage:
// $ cppcheck --check-library --library=gtk --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr --library=gtk test/cfg/gtk.cpp
// $ cppcheck --check-library --library=gtk --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr --library=gtk test/cfg/gtk.cpp
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
2 changes: 1 addition & 1 deletion test/cfg/kde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for kde.cfg
//
// Usage:
// $ cppcheck --check-library --library=kde --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/kde.cpp
// $ cppcheck --check-library --library=kde --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/kde.cpp
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
2 changes: 1 addition & 1 deletion test/cfg/libcurl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for libcurl.cfg
//
// Usage:
// $ cppcheck --check-library --library=libcurl --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/libcurl.c
// $ cppcheck --check-library --library=libcurl --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/libcurl.c
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
2 changes: 1 addition & 1 deletion test/cfg/libsigc++.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for libsigc++.cfg
//
// Usage:
// $ cppcheck --check-library --library=libsigc++ --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/libsigc++.cpp
// $ cppcheck --check-library --library=libsigc++ --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/libsigc++.cpp
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
2 changes: 1 addition & 1 deletion test/cfg/lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for lua.cfg
//
// Usage:
// $ cppcheck --check-library --library=lua --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/lua.c
// $ cppcheck --check-library --library=lua --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/lua.c
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
2 changes: 1 addition & 1 deletion test/cfg/opencv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for opencv2.cfg
//
// Usage:
// $ cppcheck --check-library --library=opencv2 --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/opencv2.cpp
// $ cppcheck --check-library --library=opencv2 --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/opencv2.cpp
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
2 changes: 1 addition & 1 deletion test/cfg/openmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for openmp.cfg
//
// Usage:
// $ cppcheck --check-library --library=openmp --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/openmp.c
// $ cppcheck --check-library --library=openmp --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/openmp.c
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
2 changes: 1 addition & 1 deletion test/cfg/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for openssl.cfg
//
// Usage:
// $ cppcheck --check-library --library=openssl --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/openssl.c
// $ cppcheck --check-library --library=openssl --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/openssl.c
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
6 changes: 3 additions & 3 deletions test/cfg/posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for posix.cfg
//
// Usage:
// $ cppcheck --check-library --library=posix --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/posix.c
// $ cppcheck --check-library --library=posix --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/posix.c
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down Expand Up @@ -1235,11 +1235,11 @@ void uninitvar_types(void)
{
// cppcheck-suppress unassignedVariable
blkcnt_t b;
// cppcheck-suppress uninitvar
// cppcheck-suppress [uninitvar,constStatement]
b + 1;

struct dirent d;
// TODO cppcheck-suppress uninitvar
// cppcheck-suppress constStatement - TODO: uninitvar
d.d_ino + 1;
}

Expand Down
2 changes: 1 addition & 1 deletion test/cfg/python.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for python.cfg
//
// Usage:
// $ cppcheck --check-library --library=python --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/python.c
// $ cppcheck --check-library --library=python --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/python.c
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
2 changes: 1 addition & 1 deletion test/cfg/qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for qt.cfg
//
// Usage:
// $ cppcheck --check-library --library=qt --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/qt.cpp
// $ cppcheck --check-library --library=qt --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/qt.cpp
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand Down
Loading