laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/24927 )
Change subject: lint: checkpatch.pl: complain about %i in printf ...................................................................... lint: checkpatch.pl: complain about %i in printf Pau has to remind me often that %d is used instead of %i in Osmocom trees, so let's automate it. Complain like this: src/vty/command.c:3052: WARNING:PRINTF_I_OSMO: Use %d instead of %i Related: OS#5087 Change-Id: I1a98326f1cbf4d2e0bb948558e5cd1726b0a9868 --- M lint/checkpatch/checkpatch.pl 1 file changed, 6 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, approved; Verified pespin: Looks good to me, but someone else must approve diff --git a/lint/checkpatch/checkpatch.pl b/lint/checkpatch/checkpatch.pl index 4da42a9..ca074a7 100755 --- a/lint/checkpatch/checkpatch.pl +++ b/lint/checkpatch/checkpatch.pl @@ -6170,6 +6170,7 @@ # check for non-standard and hex prefixed decimal printf formats my $show_L = 1; #don't show the same defect twice my $show_Z = 1; + my $show_i = 1; while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) { my $string = substr($rawline, $-[1], $+[1] - $-[1]); $string =~ s/%%/__/g; @@ -6185,6 +6186,11 @@ "%Z$1 is non-standard C, use %z$1\n" . $herecurr); $show_Z = 0; } + if ($show_i && $string =~ /%[\*\d\.\$]*i/) { # Osmocom specific + WARN("PRINTF_I_OSMO", + "Use %d instead of %i\n" . $herecurr); + $show_i = 0; + } # check for 0x<decimal> if ($string =~ /0x%[\*\d\.\$\Llzth]*[diou]/) { ERROR("PRINTF_0XDECIMAL", -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/24927 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: I1a98326f1cbf4d2e0bb948558e5cd1726b0a9868 Gerrit-Change-Number: 24927 Gerrit-PatchSet: 2 Gerrit-Owner: osmith <osm...@sysmocom.de> Gerrit-Reviewer: laforge <lafo...@osmocom.org> Gerrit-Reviewer: pespin <pes...@sysmocom.de> Gerrit-MessageType: merged