Skip to content

Commit ac110fd

Browse files
author
Your Name
committed
Merge
2 parents 0c1324c + 1fb6630 commit ac110fd

42 files changed

Lines changed: 773 additions & 49 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/CI-unixish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ jobs:
150150
- name: Run CMake install
151151
run: |
152152
cmake --build cmake.output --target install
153+
# TODO: validate the installed files
153154
154155
- name: Run CMake on ubuntu (no CLI)
155156
if: matrix.os == 'ubuntu-22.04'

.github/workflows/CI-windows.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,26 @@ jobs:
5151
- name: Run CMake
5252
run: |
5353
rem TODO: enable rules?
54-
rem specify Release build so matchcompiler is used
55-
cmake -S . -B build -Werror=dev --warn-uninitialized -DCMAKE_BUILD_TYPE=Release -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DBUILD_TESTING=Off -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DBUILD_ONLINE_HELP=On -DCMAKE_INSTALL_PREFIX=cppcheck-cmake-install -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel!
54+
cmake -S . -B build -Werror=dev --warn-uninitialized -DCMAKE_BUILD_TYPE=Debug -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DBUILD_TESTING=Off -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DBUILD_ONLINE_HELP=On -DISABLE_DMAKE=On -DCMAKE_INSTALL_PREFIX=cppcheck-cmake-install -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel!
5655
57-
- name: Build GUI release
56+
- name: Build GUI
5857
run: |
59-
cmake --build build --target cppcheck-gui --config Release || exit /b !errorlevel!
58+
cmake --build build --config Debug --target cppcheck-gui || exit /b !errorlevel!
6059
60+
# TODO: can this be done in CMake?
6161
- name: Deploy GUI
6262
run: |
63-
windeployqt build\bin\Release || exit /b !errorlevel!
64-
del build\bin\Release\cppcheck-gui.ilk || exit /b !errorlevel!
65-
del build\bin\Release\cppcheck-gui.pdb || exit /b !errorlevel!
63+
windeployqt --no-translations build\bin\Debug || exit /b !errorlevel!
64+
del build\bin\Debug\cppcheck-gui.pdb || exit /b !errorlevel!
6665
6766
# TODO: run GUI tests
6867

6968
- name: Run CMake install
7069
run: |
71-
cmake --build build --target install
70+
rem TODO: the Qt DLLs are not being installed
71+
cmake --build build --config Debug --target install
72+
rem TODO: validate the installed files
73+
rem TODO: the structure does not match an actual Windows installation
7274
7375
build_cmake_cxxstd:
7476
strategy:

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ Felipe Pena
133133
Felix Faber
134134
Felix Geyer
135135
Felix Passenberg
136+
Felix Patschkowski
136137
Felix Wolff
137138
Florian Mueller
138139
Florin Iucha

cfg/microsoft_gsl.cfg

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<def>
3+
<define name="Expects(x)" value=""/>
4+
<define name="Ensures(x)" value=""/>
5+
<define name="GSL_SUPPRESS(x)" value=""/>
6+
<podtype name="gsl::index" sign="s"/>
7+
<podtype name="gsl::byte" sign="u" size="1"/><!-- Deprecated in GSL -->
8+
<container id="gslSpan" startPattern="gsl :: span" inherits="stdSpan">
9+
</container>
10+
<smart-pointer class-name="gsl::owner"/>
11+
<smart-pointer class-name="gsl::not_null"/>
12+
<smart-pointer class-name="gsl::unique_ptr"><!-- Deprecated in GSL -->
13+
<unique/>
14+
</smart-pointer>
15+
<smart-pointer class-name="gsl::shared_ptr"/><!-- Deprecated in GSL -->
16+
<smart-pointer class-name="gsl::strict_not_null"/><!-- non-existing in C++ Core Guidelines -->
17+
</def>

cli/CMakeLists.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,32 @@ if (BUILD_CLI)
4040
endif()
4141

4242
install(TARGETS cppcheck
43-
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
43+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
4444
COMPONENT applications)
4545

4646
install(PROGRAMS ${CMAKE_SOURCE_DIR}/htmlreport/cppcheck-htmlreport
47-
DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
47+
DESTINATION ${CMAKE_INSTALL_BINDIR}
4848
COMPONENT applications)
4949

50+
# TODO: leverage CMAKE_INSTALL_DATAROOTDIR (share)?
51+
5052
install(FILES ${addons_py}
51-
DESTINATION ${FILESDIR_DEF}/addons
53+
DESTINATION ${FILESDIR_INSTALL}/addons
5254
COMPONENT headers)
5355

5456
install(FILES ${addons_json}
55-
DESTINATION ${FILESDIR_DEF}/addons
57+
DESTINATION ${FILESDIR_INSTALL}/addons
5658
COMPONENT headers)
5759

5860
install(FILES ${cfgs}
59-
DESTINATION ${FILESDIR_DEF}/cfg
61+
DESTINATION ${FILESDIR_INSTALL}/cfg
6062
COMPONENT headers)
6163

6264
install(FILES ${platforms}
63-
DESTINATION ${FILESDIR_DEF}/platforms
65+
DESTINATION ${FILESDIR_INSTALL}/platforms
6466
COMPONENT headers)
6567

68+
# TODO: install manpage into CMAKE_INSTALL_MANDIR
69+
# TODO: install documentation into CMAKE_INSTALL_DOCDIR?
70+
6671
endif()

cmake/options.cmake

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,22 @@ set(CMAKE_DISABLE_PRECOMPILE_HEADERS Off CACHE BOOL "Disable precompiled headers
134134
# see https://gitlab.kitware.com/cmake/cmake/-/issues/21219
135135
set(CMAKE_PCH_PROLOGUE "")
136136

137+
# TODO: do we need to set these?
137138
set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE ${CMAKE_INSTALL_PREFIX}/include CACHE PATH "Output directory for headers")
138139
set(CMAKE_LIB_DIRS_CONFIGCMAKE ${CMAKE_INSTALL_PREFIX}/lib CACHE PATH "Output directory for libraries")
139140

141+
# TODO: do we need to set these?
140142
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
141143
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
142144
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
143145

144146
string(LENGTH "${FILESDIR}" _filesdir_len)
145147
# override FILESDIR if it is set or empty
148+
# needs to be an absolute path in Cppcheck but a relative one for CMake install
146149
if(FILESDIR OR ${_filesdir_len} EQUAL 0)
147-
# TODO: verify that it is an absolute path?
150+
set(FILESDIR_INSTALL "${FILESDIR}") # TODO: make relative - leverage CMAKE_INSTALL_DATAROOTDIR?
148151
set(FILESDIR_DEF "${FILESDIR}")
149152
else()
150-
set(FILESDIR_DEF ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME} CACHE STRING "Cppcheck files directory")
153+
set(FILESDIR_INSTALL "share/${PROJECT_NAME}")
154+
set(FILESDIR_DEF "${CMAKE_INSTALL_PREFIX}/${FILESDIR_INSTALL}")
151155
endif()

cmake/printInfo.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ message(STATUS "Compiler Version = ${CMAKE_CXX_COMPILER_VERSION}")
88
message(STATUS "Build type = ${CMAKE_BUILD_TYPE}")
99
message(STATUS "CMake C++ Standard = ${CMAKE_CXX_STANDARD}")
1010
message(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")
11+
message(STATUS "CMAKE_INSTALL_BINDIR = ${CMAKE_INSTALL_BINDIR}")
1112
message(STATUS "CMAKE_DISABLE_PRECOMPILE_HEADERS = ${CMAKE_DISABLE_PRECOMPILE_HEADERS}")
1213
message(STATUS "C++ flags (General) = ${CMAKE_CXX_FLAGS}")
1314
message(STATUS "C++ flags (Release) = ${CMAKE_CXX_FLAGS_RELEASE}")
@@ -109,6 +110,7 @@ message(STATUS)
109110
message(STATUS "USE_LIBCXX = ${USE_LIBCXX}")
110111
message(STATUS)
111112
message(STATUS "FILESDIR = ${FILESDIR}")
113+
message(STATUS "FILESDIR_INSTALL = ${FILESDIR_INSTALL}")
112114
message(STATUS "FILESDIR_DEF = ${FILESDIR_DEF}")
113115
message(STATUS)
114116

gui/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ CheckOptions:
7171
add_dependencies(cppcheck-gui online-help.qhc)
7272
endif()
7373

74-
install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
75-
install(FILES ${qms} DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
74+
install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT applications)
75+
install(FILES ${qms} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT applications)
7676

7777
install(FILES cppcheck-gui.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
7878

lib/astutils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3002,7 +3002,7 @@ bool isVariableChanged(const Variable * var, const Settings &settings, int depth
30023002
const Token * start = var->declEndToken();
30033003
if (!start)
30043004
return false;
3005-
if (Token::Match(start, "; %varid% =", var->declarationId()))
3005+
if (Token::Match(start, "; %varid% =", var->declarationId()) && !Token::simpleMatch(start->previous(), ")"))
30063006
start = start->tokAt(2);
30073007
if (Token::simpleMatch(start, "=")) {
30083008
const Token* next = nextAfterAstRightmostLeafGeneric(start);

lib/checkio.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ void CheckIOImpl::checkFileUsage()
155155
tok = tok->linkAt(1);
156156
continue;
157157
}
158+
if (tok->function() && tok->function()->nestedIn)
159+
continue;
158160
if (tok->str() == "{")
159161
indent++;
160162
else if (tok->str() == "}") {
@@ -841,6 +843,8 @@ void CheckIOImpl::checkFormatString(const Token * const tok,
841843
}
842844
++i;
843845
}
846+
while (!width.empty() && width[0] == '0')
847+
width = width.substr(1);
844848
auto bracketBeg = formatString.cend();
845849
if (i != formatString.cend() && *i == '[') {
846850
bracketBeg = i;

0 commit comments

Comments
 (0)