|
| 1 | +# clang-tidy config for virtualjaguar-libretro. |
| 2 | +# |
| 3 | +# Curated check list aimed at catching real bugs in emulator C code |
| 4 | +# without flooding the diff with style-preference noise. See the |
| 5 | +# CI workflow `clang-tidy` job for how this is invoked (only on |
| 6 | +# PR-changed files). |
| 7 | +# |
| 8 | +# Disabled checks rationale below each `-` entry. |
| 9 | + |
| 10 | +Checks: > |
| 11 | + bugprone-*, |
| 12 | + clang-analyzer-*, |
| 13 | + readability-inconsistent-declaration-parameter-name, |
| 14 | + readability-misleading-indentation, |
| 15 | + readability-redundant-control-flow, |
| 16 | + misc-redundant-expression, |
| 17 | + -bugprone-easily-swappable-parameters, |
| 18 | + -bugprone-narrowing-conversions, |
| 19 | + -bugprone-implicit-widening-of-multiplication-result, |
| 20 | + -bugprone-reserved-identifier, |
| 21 | + -bugprone-assignment-in-if-condition, |
| 22 | + -bugprone-macro-parentheses, |
| 23 | + -bugprone-signed-char-misuse, |
| 24 | + -bugprone-suspicious-include, |
| 25 | + -bugprone-switch-missing-default-case, |
| 26 | + -bugprone-branch-clone, |
| 27 | + -clang-analyzer-deadcode.DeadStores, |
| 28 | + -clang-analyzer-optin.portability.UnixAPI, |
| 29 | + -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling, |
| 30 | + -clang-analyzer-valist.Uninitialized |
| 31 | +
|
| 32 | +# Don't promote to errors yet -- the workflow itself decides via |
| 33 | +# --warnings-as-errors / continue-on-error. |
| 34 | +WarningsAsErrors: '' |
| 35 | + |
| 36 | +# Apply checks to in-tree headers but skip vendored / generated. |
| 37 | +HeaderFilterRegex: '^(src/(core|tom|jerry|cd)|libretro\.c).*' |
| 38 | + |
| 39 | +# Don't run clang-format inline (we have a separate clang-format job). |
| 40 | +FormatStyle: none |
| 41 | + |
| 42 | +# Disabled-check rationale: |
| 43 | +# - easily-swappable-parameters: emulator hot paths take many same-typed args. |
| 44 | +# - narrowing-conversions / implicit-widening: register byte ops trip these constantly. |
| 45 | +# - reserved-identifier: __LIBRETRO__ and UAE __regs/__pads use reserved names by design. |
| 46 | +# - assignment-in-if-condition: idiomatic in dispatch loops. |
| 47 | +# - macro-parentheses: misfires on GET16/SET32 byte-swap macros. |
| 48 | +# - signed-char-misuse: ROM byte buffers commonly use signed char. |
| 49 | +# - suspicious-include: project includes .c files in a couple of dispatch headers. |
| 50 | +# - switch-missing-default-case: cosmetic; switches on bit-field decode patterns |
| 51 | +# commonly omit default because all valid bit values are handled. |
| 52 | +# - branch-clone: register-decode if-chains in src/cd/cdrom.c and src/tom/tom.c |
| 53 | +# intentionally write the same value for several adjacent register addresses |
| 54 | +# to make the address->effect mapping legible. Real bug clones are caught |
| 55 | +# by code review, not this check. |
| 56 | +# - deadcode.DeadStores: blitter / OP / register-decode functions self-doc-init |
| 57 | +# locals that are read via macros (BCOMPEN, DSTA2, ...) clang-tidy can't see |
| 58 | +# the linkage for. Removing these inits would introduce real bugs. |
| 59 | +# - DeprecatedOrUnsafeBufferHandling: MSVC-flavored noise about strcpy/sprintf. |
| 60 | +# - optin.portability.UnixAPI: false positive on libretro_core_options.h calloc. |
| 61 | +# - valist.Uninitialized: false-positive prone on our log macros. |
0 commit comments