From: Daan De Meyer Date: Tue, 29 Apr 2025 12:34:37 +0000 (+0200) Subject: cleanup: update bug prone argument comments (#37281) X-Git-Tag: v258-rc1~726 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4cf30a318ab3a2ffe1d236a8c69d63850f25b595;p=thirdparty%2Fsystemd.git cleanup: update bug prone argument comments (#37281) @DaanDeMeyer Obviously this doesn't fix nearly everything, so gradually moving things over is probably a smart thing? It seems clang-tidy does support drop in configs for example: ``` # SPDX-License-Identifier: LGPL-2.1-or-later --- Checks: ' -*, bugprone-argument-comment ' WarningsAsErrors: '*' ``` Its a bit strange that `WarningsAsErrors` isn't propagated, but dropping this file in src/report/.clang-tiday invokes: ``` [1314/1543][1.5s] /usr/bin/clang-tidy --use-color -extra-arg=-fno-caret-diagnostics -p=/home/jelle/projects/systemd/build -quiet /home/jelle/projec ts/systemd/src/repart/repart.c ../src/repart/repart.c:4715:41: error: argument name 'pubkey' in comment does not match parameter name 'public' [bugprone-argument-comment,-warning s-as-errors] 4715 | /* pubkey= */ NULL, /* Turn this one off for the 2nd shard */ | ^ ../src/shared/tpm2-util.h:281:108: note: 'public' declared here 281 | int tpm2_calculate_sealing_policy(const Tpm2PCRValue *pcr_values, size_t n_pcr_values, const TPM2B_PUBLIC *public, bool use_pin, const Tpm2 PCRLockPolicy *policy, TPM2B_DIGEST *digest); | ^ ``` So that seems to behave as intended :) And in some cases I am not sure if switching to the correct argument is an improvement ie.: ``` ../src/bootctl/bootctl-reboot-to-firmware.c:66:51: [38;2;190;132;255m0;1;31merror: argument name 'dispatch_table' in comment does not match paramet er name 'table' [bugprone-argument-comment,-warnings-as-errors] 66 | r = sd_varlink_dispatch(link, parameters, /* dispatch_table = */ NULL, /* userdata = */ NULL); | [38;2;190;132;255m0;1;32m ^ ../src/systemd/sd-varlink.h:187:98: [38;2;190;132;255m0;1;36mnote: 'table' declared here 187 | int sd_varlink_dispatch(sd_varlink *v, sd_json_variant *parameters, const sd_json_dispatch_field table[], void *userdata); | [38;2;190;132;255m0;1;32m ^ ``` or ``` ../src/validatefs/validatefs.c:274:83: [38;2;190;132;255m0;1;31merror: argument name 'ret_len' in comment does not match parameter name 'len' [bugprone-argument-comment,-warnings-as-errors] 274 | (void) blkid_probe_lookup_value(b, "PART_ENTRY_TYPE", &v, /* ret_len= */ NULL); | [38;2;190;132;255m0;1;32m ^ /usr/include/blkid/blkid.h:455:52: [38;2;190;132;255m0;1;36mnote: 'len' declared here 455 | const char **data, size_t *len) | [38;2;190;132;255m0;1;32m ^ ``` But that's also half a style thing with `len` winning over `ret_len`. --- 4cf30a318ab3a2ffe1d236a8c69d63850f25b595