Skip to content

Commit e906af9

Browse files
committed
Move version-specific cppcheck suppressions to --suppress flags for cross-OS compatibility
1 parent 5b18f7d commit e906af9

2 files changed

Lines changed: 11 additions & 26 deletions

File tree

.cppcheck

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,15 @@
11
# cppcheck suppressions file
2-
#
3-
# Suppress false positives and checks not relevant to our codebase.
4-
# Philosophy: suppress as little as possible.
2+
# Only universally-supported suppression IDs here.
3+
# Version-specific IDs go in Makefile.cbm as --suppress flags.
54

6-
# We use _Thread_local extensively — cppcheck doesn't fully understand it
7-
threadsafety:*
8-
9-
# Vendored code (tree-sitter grammars, yyjson, sqlite3)
5+
# Vendored code
106
*:internal/cbm/vendored/*
117
*:vendored/*
128

13-
# Test framework uses some patterns cppcheck doesn't like
9+
# Test framework patterns
1410
unusedFunction:tests/*
1511

16-
# We intentionally use variable-length printf format strings
17-
formatStringUsedSafely
18-
19-
# OOM handling: CLI tool — crash is acceptable on allocation failure.
20-
# Real bugs (unsafe realloc) are fixed; these are about NULL deref after
21-
# malloc/calloc which on modern systems means the process is dying anyway.
22-
nullPointerOutOfMemory
23-
nullPointerArithmeticOutOfMemory
24-
ctunullpointerOutOfMemory
25-
26-
# Intentional (void*)1 sentinel pattern for hash table presence checks
27-
intToPointerCast
28-
29-
# cbm_log_info() uses NULL sentinel — macro adds it automatically
30-
varFuncNullUB
31-
32-
# Const correctness for vendor API types (yyjson, sqlite) — adding const
33-
# requires casts against their APIs. Low value, high churn.
12+
# Intentional patterns
3413
constVariablePointer
3514
constParameterPointer
3615
constVariable

Makefile.cbm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,12 @@ lint-cppcheck:
440440
--error-exitcode=1 \
441441
--inline-suppr \
442442
--quiet \
443+
--suppress=varFuncNullUB \
444+
--suppress=intToPointerCast \
445+
--suppress=nullPointerOutOfMemory \
446+
--suppress=nullPointerArithmeticOutOfMemory \
447+
--suppress=ctunullpointerOutOfMemory \
448+
--suppress='nullPointer:internal/cbm/sqlite_writer.c' \
443449
-Isrc -Ivendored -Ivendored/sqlite3 \
444450
-I$(CBM_DIR) -I$(TS_INCLUDE) \
445451
$(LINT_SRCS)

0 commit comments

Comments
 (0)