Skip to content

Commit d6bca49

Browse files
authored
updated CI to Clang 18 (cppcheck-opensource#5305)
1 parent 06c8363 commit d6bca49

15 files changed

Lines changed: 42 additions & 35 deletions

.clang-tidy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Checks: >
3939
-misc-use-anonymous-namespace,
4040
-modernize-avoid-c-arrays,
4141
-modernize-deprecated-ios-base-aliases,
42-
-modernize-use-nullptr,
4342
-misc-include-cleaner,
4443
-misc-unused-using-decls,
4544
-modernize-loop-convert,
@@ -52,12 +51,14 @@ Checks: >
5251
-modernize-use-nodiscard,
5352
-modernize-use-trailing-return-type,
5453
-performance-avoid-endl,
54+
-performance-enum-size,
5555
-performance-inefficient-string-concatenation,
5656
-performance-no-automatic-move,
5757
-performance-noexcept-swap,
5858
-portability-simd-intrinsics,
5959
-portability-std-allocator-const,
6060
-readability-avoid-const-params-in-decls,
61+
-readability-avoid-nested-conditional-operator,
6162
-readability-braces-around-statements,
6263
-readability-container-data-pointer,
6364
-readability-function-cognitive-complexity,

.github/workflows/asan.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
5050
wget https://apt.llvm.org/llvm.sh
5151
chmod +x llvm.sh
52-
sudo ./llvm.sh 17
52+
sudo ./llvm.sh 18
5353
5454
- name: Install Qt ${{ env.QT_VERSION }}
5555
if: false
@@ -70,8 +70,8 @@ jobs:
7070
run: |
7171
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=Off -DWITH_QCHART=Off -DUSE_MATCHCOMPILER=Verify -DANALYZE_ADDRESS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=Off -DDISABLE_DMAKE=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
7272
env:
73-
CC: clang-17
74-
CXX: clang++-17
73+
CC: clang-18
74+
CXX: clang++-18
7575

7676
- name: Build cppcheck
7777
run: |

.github/workflows/clang-tidy.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
3838
wget https://apt.llvm.org/llvm.sh
3939
chmod +x llvm.sh
40-
sudo ./llvm.sh 17
41-
sudo apt-get install -y clang-tidy-17
40+
sudo ./llvm.sh 18
41+
sudo apt-get install -y clang-tidy-18
4242
4343
- name: Install Qt ${{ env.QT_VERSION }}
4444
uses: jurplel/install-qt-action@v3
@@ -49,14 +49,14 @@ jobs:
4949

5050
- name: Verify clang-tidy configuration
5151
run: |
52-
clang-tidy-17 --verify-config
52+
clang-tidy-18 --verify-config
5353
5454
- name: Prepare CMake
5555
run: |
5656
cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCPPCHK_GLIBCXX_DEBUG=Off
5757
env:
58-
CC: clang-17
59-
CXX: clang++-17
58+
CC: clang-18
59+
CXX: clang++-18
6060

6161
- name: Prepare CMake dependencies
6262
run: |

.github/workflows/iwyu.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ jobs:
128128
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
129129
wget https://apt.llvm.org/llvm.sh
130130
chmod +x llvm.sh
131-
sudo ./llvm.sh 17
132-
sudo apt-get install -y clang-tools-17
131+
sudo ./llvm.sh 18
132+
sudo apt-get install -y clang-tools-18
133133
134134
- name: Install Qt ${{ env.QT_VERSION }}
135135
uses: jurplel/install-qt-action@v3
@@ -142,8 +142,8 @@ jobs:
142142
run: |
143143
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On
144144
env:
145-
CC: clang-17
146-
CXX: clang++-17
145+
CC: clang-18
146+
CXX: clang++-18
147147

148148
- name: Prepare CMake dependencies
149149
run: |
@@ -160,7 +160,7 @@ jobs:
160160
- name: clang-include-cleaner
161161
run: |
162162
# TODO: run multi-threaded
163-
find $PWD/cli $PWD/lib $PWD/test -maxdepth 1 -name "*.cpp" | xargs -t -n 1 clang-include-cleaner-17 --print=changes --extra-arg=-w -p cmake.output > clang-include-cleaner.log 2>&1
163+
find $PWD/cli $PWD/lib $PWD/test -maxdepth 1 -name "*.cpp" | xargs -t -n 1 clang-include-cleaner-18 --print=changes --extra-arg=-w -p cmake.output > clang-include-cleaner.log 2>&1
164164
165165
- uses: actions/upload-artifact@v3
166166
with:

.github/workflows/tsan.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
5050
wget https://apt.llvm.org/llvm.sh
5151
chmod +x llvm.sh
52-
sudo ./llvm.sh 17
52+
sudo ./llvm.sh 18
5353
5454
- name: Install Qt ${{ env.QT_VERSION }}
5555
if: false
@@ -69,8 +69,8 @@ jobs:
6969
run: |
7070
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=Off -DWITH_QCHART=Off -DUSE_MATCHCOMPILER=Verify -DANALYZE_THREAD=On -DUSE_THREADS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=Off -DDISABLE_DMAKE=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
7171
env:
72-
CC: clang-17
73-
CXX: clang++-17
72+
CC: clang-18
73+
CXX: clang++-18
7474

7575
- name: Build cppcheck
7676
run: |

.github/workflows/ubsan.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
5050
wget https://apt.llvm.org/llvm.sh
5151
chmod +x llvm.sh
52-
sudo ./llvm.sh 17
52+
sudo ./llvm.sh 18
5353
5454
- name: Install Qt ${{ env.QT_VERSION }}
5555
uses: jurplel/install-qt-action@v3
@@ -69,8 +69,8 @@ jobs:
6969
run: |
7070
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DUSE_MATCHCOMPILER=Verify -DANALYZE_UNDEFINED=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
7171
env:
72-
CC: clang-17
73-
CXX: clang++-17
72+
CC: clang-18
73+
CXX: clang++-18
7474

7575
- name: Build cppcheck
7676
run: |

clang-tidy.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ We run this separately via `clang-include-cleaner` in the `iwyu.yml` workflow as
129129
`performance-noexcept-swap`<br/>
130130
`bugprone-switch-missing-default-case`<br/>
131131
`bugprone-empty-catch`<br/>
132+
`performance-enum-size`<br/>
133+
`readability-avoid-nested-conditional-operator`</br>
132134

133135
To be evaluated (need to remove exclusion).
134136

@@ -185,10 +187,6 @@ It does not seem to produce any warnings for us (needs to be investigated) and i
185187

186188
This is the most expensive check for several files and it is providing much in terms of code quality. Reported upstream as https://github.com/llvm/llvm-project/issues/72300.
187189

188-
`modernize-use-nullptr`
189-
190-
This is already covered by the `-Wzero-as-null-pointer-constant` compiler warning so there is no need for an additional check.
191-
192190
### Disabled for GUI only
193191

194192
`readability-convert-member-functions-to-static`<br/>

cli/stacktrace.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ void print_stacktrace(FILE* output, bool demangling, int maxdepth, bool lowMem)
8585
(int)(firstBracketAddress-symbolString), symbolString);
8686
}
8787
}
88+
// NOLINTNEXTLINE(bugprone-multi-level-implicit-pointer-conversion) - code matches the documented usage
8889
free(symbolStringList);
8990
} else {
9091
fputs("Callstack could not be obtained\n", output);

cmake/clang_tidy.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if (NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)
1111
message(STATUS "Cannot use non-Clang compiler with clang-tidy when precompiled headers are enabled - skipping 'run-clang-tidy' target generation")
1212
endif()
1313
else()
14-
set(RUN_CLANG_TIDY_NAMES run-clang-tidy run-clang-tidy-17 run-clang-tidy-16 run-clang-tidy-15 run-clang-tidy-14 run-clang-tidy-13 run-clang-tidy-12 run-clang-tidy-11 run-clang-tidy-10 run-clang-tidy-9 run-clang-tidy-8)
14+
set(RUN_CLANG_TIDY_NAMES run-clang-tidy run-clang-tidy-18 run-clang-tidy-17 run-clang-tidy-16 run-clang-tidy-15 run-clang-tidy-14 run-clang-tidy-13 run-clang-tidy-12 run-clang-tidy-11 run-clang-tidy-10 run-clang-tidy-9 run-clang-tidy-8)
1515
endif()
1616

1717
if (RUN_CLANG_TIDY_NAMES)

cmake/compilerDefinitions.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ if (MSVC)
1010
add_definitions(-D_WIN64)
1111
endif()
1212

13-
# TODO: this should probably apply to the compiler and not the platform
13+
# TODO: this should probably apply to the compiler and not the platform - I think it is only "broken" with MinGW
14+
# TODO: AppleClang only has libc++
15+
# TODO: what about clang-cl and native Win32 clang?
1416
if (CPPCHK_GLIBCXX_DEBUG AND UNIX AND CMAKE_BUILD_TYPE STREQUAL "Debug")
1517
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1618
if (USE_LIBCXX)
17-
add_definitions(-D_LIBCPP_ENABLE_ASSERTIONS=1)
19+
if (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 18 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 18)
20+
add_definitions(-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG)
21+
else()
22+
add_definitions(-D_LIBCPP_ENABLE_ASSERTIONS=1)
23+
endif()
1824
# TODO: also add _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS?
1925
endif()
2026
else()

0 commit comments

Comments
 (0)