Fix inconsistent parameter names between definition/declaration pairs

For the sake of consistency, function definitions and their
corresponding declarations should use the same names for parameters.
I've enabled this check in static analysis to prevent this issue from
occurring again in the future.
This commit is contained in:
Kevin Svetlitski 2023-07-06 16:27:56 -07:00 committed by Qi Wang
parent 5711dc31d8
commit 1d9e9c2ed6
7 changed files with 25 additions and 16 deletions

View file

@ -27,7 +27,7 @@ EXTRA_CFLAGS='-Wstrict-prototypes' EXTRA_CXXFLAGS='-Wstrict-prototypes' ./autoge
# otherwise you'll get tons of warnings for things
# that are already covered by `assert`s.
bear -- make -s -j $(nproc)
bear -- make -s -j "$(nproc)"
# We end up with lots of duplicate entries in the compilation database, one for
# each output file type (e.g. .o, .d, .sym, etc.). There must be exactly one
# entry for each file in the compilation database in order for
@ -35,9 +35,18 @@ bear -- make -s -j $(nproc)
jq '[.[] | select(.output | test("/[^./]*\\.o$"))]' compile_commands.json > compile_commands.json.tmp
mv compile_commands.json.tmp compile_commands.json
CC_ANALYZERS_FROM_PATH=1 CodeChecker analyze compile_commands.json --jobs $(nproc) \
# CodeChecker has a bug where it freaks out if you supply the skipfile via process substitution,
# so we resort to manually creating a temporary file
skipfile=$(mktemp)
# The single-quotes are deliberate here, you want `$skipfile` to be evaluated upon exit
trap 'rm -f $skipfile' EXIT
echo '-**/stdlib.h' > "$skipfile"
CC_ANALYZERS_FROM_PATH=1 CodeChecker analyze compile_commands.json --jobs "$(nproc)" \
--ctu --compile-uniqueing strict --output static_analysis_raw_results \
--analyzers clang-tidy clangsa
--analyzers clangsa clang-tidy --skip "$skipfile" \
--enable readability-inconsistent-declaration-parameter-name
# `--enable` is additive, the vast majority of the checks we want are
# enabled by default.
html_output_dir="${1:-static_analysis_results}"
result=${2:-/dev/null}