forked from TrenchBroom/TrenchBroom
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2669: Fix some deficiencies found by cppcheck (TrenchBroom#2670)
* 2669: Fix initialization of default values for attribute definitions by using std::optional. * 2669: Don’t delete iterator delegate on self assignment. * 2669: Initialize file serializer formats in initialization list. * 2669: Add forgotten std::move. * 2669: Inline variable declarations are reported as syntax errors by cppcheck. * 2669: Initialize member in initialization list. * 2669: Remove unused member variable. * 2669: Typos. * 2669: Pass by reference and use of explicit types to avoid a warning. * 2669: More syntax errors. * 2669: Forgotten std::move. * 2669: Use Xcode 10 on travis to enable use of optional header. * 2669: Initialize current object. * 2669: Pass msg by reference. * 2669: Silence a cppcheck warning about using a non const method in an assertion. * 2669: Fix type error. * 2669: Fix auto type oddities. * 2669: Don’t call non const functions in assertions. Be more resilient in these cases and don’t assert at all. * 2669: Fix shortcut sorting. * 2669: Don't hide raw C pointers behind auto. * 2669: Run cppcheck if installed * 2669: Fix more cppcheck warnings. * 2669: Install cppcheck on our travis Linux builds * 2669: Install cppcheck on our travis mac builds * 2669: Skip cppcheck on travis mac, homebrew does not have a cask for it. * 2669: Lies! * 2669: Run cppcheck target specifically, be resilient if cppcheck is not installed. * 2669: Run cppcheck for windows builds too. * 2669: Fix cppcheck cmake integration. * 2669: Enable support for building a report for cppcheck results. Disable cppcheck on travis / linux due to outdated package.
- Loading branch information
Showing
81 changed files
with
476 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
LIST(APPEND CPPCHECK_ARGS | ||
--enable=warning,performance,portability | ||
--verbose | ||
--suppressions-list=${CMAKE_SOURCE_DIR}/cppcheck.suppr | ||
--std=c++11 | ||
--language=c++ | ||
--xml | ||
--error-exitcode=1 | ||
-DMAIN=main | ||
-I ${VECMATH_INCLUDE_DIR} | ||
${COMMON_SOURCE_DIR} | ||
2> ./err.xml | ||
) | ||
|
||
LIST(APPEND CPPCHECK_HTMLREPORT_ARGS | ||
--file err.xml | ||
--report-dir=cppcheck_report | ||
--source-dir=${CMAKE_SOURCE_DIR} | ||
) | ||
|
||
FIND_PROGRAM(CPPCHECK_EXE cppcheck) | ||
|
||
IF (CPPCHECK_EXE STREQUAL "CPPCHECK_EXE-NOTFOUND") | ||
MESSAGE(STATUS "Could not find cppcheck, skipping checks") | ||
ADD_CUSTOM_TARGET( | ||
cppcheck | ||
COMMENT "skipping cppcheck" | ||
) | ||
ELSE() | ||
MESSAGE(STATUS "Using cppcheck found at ${CPPCHECK_EXE}") | ||
ADD_CUSTOM_TARGET( | ||
cppcheck | ||
COMMAND ${CPPCHECK_EXE} ${CPPCHECK_ARGS} | ||
COMMENT "running cppcheck" | ||
) | ||
|
||
FIND_PROGRAM(CPPCHECK_HTMLREPORT_EXE cppcheck-htmlreport) | ||
IF (NOT CPPCHECK_HTMLREPORT_EXE STREQUAL "CPPCHECK_HTMLREPORT_EXE-NOTFOUND") | ||
ADD_CUSTOM_TARGET( | ||
cppcheck-report | ||
COMMAND ${CPPCHECK_HTMLREPORT_EXE} ${CPPCHECK_HTMLREPORT_ARGS} | ||
COMMENT "running cppcheck-htmlreport" | ||
) | ||
ENDIF() | ||
ENDIF() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.