Skip to content

Commit 8c7436d

Browse files
committed
inject error
1 parent c2f2795 commit 8c7436d

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

.github/workflows/clang-tidy.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ jobs:
3131
cmake -S . -B build \
3232
-DCMAKE_CXX_COMPILER=clang++ \
3333
-DCMAKE_C_COMPILER=clang \
34+
-DCMAKE_CXX_FLAGS="-Waddress" \
35+
-DCMAKE_C_FLAGS="-Waddress" \
3436
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
3537
-DCHECK_FOR_UPDATES=OFF \
3638
-DBUILD_EXAMPLES=ON \
3739
-DBUILD_TOOLS=ON \
38-
-DCMAKE_BUILD_TYPE=Release
40+
-DENABLE_SECURITY_FLAGS=ON \
41+
-DCMAKE_BUILD_TYPE=Debug
3942
4043
- name: Build project
4144
run: cmake --build build -j$(nproc)
@@ -47,10 +50,6 @@ jobs:
4750
-*,
4851
bugprone-string-compare,
4952
bugprone-suspicious-string-compare,
50-
bugprone-string-literal-with-embedded-nul,
51-
bugprone-compare-pointer-to-member-virtual-function,
52-
bugprone-signed-char-misuse,
53-
bugprone-bool-pointer-implicit-conversion,
5453
bugprone-argument-comment,
5554
bugprone-assert-side-effect,
5655
bugprone-branch-clone,
@@ -102,7 +101,7 @@ jobs:
102101
cert-msc50-cpp,
103102
cert-msc51-cpp,
104103
cert-oop58-cpp,
105-
readability-string-compare,
104+
clang-diagnostic-address,
106105
readability-implicit-bool-conversion,
107106
modernize-use-nullptr,
108107
performance-inefficient-string-concatenation
@@ -114,6 +113,8 @@ jobs:
114113
value: 'false'
115114
- key: readability-implicit-bool-conversion.AllowPointerConditions
116115
value: 'false'
116+
- key: clang-diagnostic-address
117+
value: 'true'
117118
EOF
118119
echo "Created .clang-tidy configuration:"
119120
cat .clang-tidy
@@ -160,10 +161,11 @@ jobs:
160161
# === NEW: Extract errors only to a separate log ===
161162
- name: Extract errors from clang-tidy log
162163
run: |
163-
# Extract actual clang-tidy errors, excluding:
164+
# Extract actual clang-tidy warnings/errors, excluding:
164165
# - clang-diagnostic-* (compilation errors)
165166
# - "Error while processing" messages
166-
grep -E 'error:' clang-tidy.log | \
167+
# Match format: /path/to/file.cpp:123:45: error: message [check-name]
168+
grep -E '^[^:]+:[0-9]+:[0-9]+: (error):' clang-tidy.log | \
167169
grep -v '\[clang-diagnostic' | \
168170
grep -v 'Error while processing' > clang-tidy-errors.log || true
169171

src/ds/d400/d400-auto-calibration.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,13 @@ namespace librealsense
271271
case ds_calib_common::SPEED_WHITE_WALL:
272272
_total_frames = 120;
273273
/* Inject string comparation issue by purpose to see if clang tidy finds it - REMOVE!!*/
274-
char * tmp = "NIR";
275-
if (tmp == "NIR")
276-
int a = 0;
274+
{
275+
const char * tmp = "NIR";
276+
if (tmp == "NIR") {
277+
int a = 0;
278+
a++; // Use the variable
279+
}
280+
}
277281
break;
278282
}
279283
std::fill_n(_fill_factor, 256, 0);

tools/dds/dds-adapter/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# License: Apache 2.0. See LICENSE file in root directory.
22
# Copyright(c) 2023-2024 RealSense, Inc. All Rights Reserved.
3-
cmake_minimum_required( VERSION 3.8 )
3+
cmake_minimum_required( VERSION 3.10 )
44
project( rs-dds-adapter )
55

66
set(TOOL_FILES

0 commit comments

Comments
 (0)