clang-tidy: Address warning readability-avoid-const-params-in-decls

clang-tidy output was:
> [..]/tests/handlers.h:502:64: error: parameter 'index' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls,-warnings-as-errors]
>   502 | _handler_record_get(const struct handler_record_list *storage, const int index,
>       |                                                                ^~~~~
> [..]/tests/handlers.h:503:39: error: parameter 'line' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls,-warnings-as-errors]
>   503 |                     const char *file, const int line);
>       |                                       ^~~~~
This commit is contained in:
Sebastian Pipping 2024-01-12 22:18:19 +01:00
parent 7664ecdbae
commit 225ebd45e1
3 changed files with 12 additions and 6 deletions

View file

@ -32,6 +32,11 @@ set -e -u -o pipefail
cd "$(dirname "$(type -P "$0")")"
checks_to_enable=(
readability-avoid-const-params-in-decls
)
checks_to_enable_flat="${checks_to_enable[*]}" # i.e. flat string separated by spaces
checks_to_disable=(
# Would need a closer look before any adjustments
clang-analyzer-optin.performance.Padding
@ -42,8 +47,9 @@ checks_to_disable=(
# Disabling because buggy, see https://github.com/llvm/llvm-project/issues/40656
clang-analyzer-valist.Uninitialized
)
checks="${checks_to_disable[*]}" # i.e. flat string separated by spaces
checks="-${checks// /,-}"
checks_to_disable_flat="${checks_to_disable[*]}" # i.e. flat string separated by spaces
checks="${checks_to_enable_flat// /,},-${checks_to_disable_flat// /,-}"
args=(
--checks="${checks}"

View file

@ -1715,8 +1715,8 @@ record_element_end_handler(void *userData, const XML_Char *name) {
}
const struct handler_record_entry *
_handler_record_get(const struct handler_record_list *storage, const int index,
const char *file, const int line) {
_handler_record_get(const struct handler_record_list *storage, int index,
const char *file, int line) {
_assert_true(storage->count > index, file, line, "too few handler calls");
return &storage->entries[index];
}

View file

@ -499,8 +499,8 @@ extern void XMLCALL record_element_end_handler(void *userData,
const XML_Char *name);
extern const struct handler_record_entry *
_handler_record_get(const struct handler_record_list *storage, const int index,
const char *file, const int line);
_handler_record_get(const struct handler_record_list *storage, int index,
const char *file, int line);
# define handler_record_get(storage, index) \
_handler_record_get((storage), (index), __FILE__, __LINE__)