Change in osmo-ci[master]: lint: checkpatch.pl: complain about %i in printf

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Tue Jul 13 11:01:14 UTC 2021


osmith has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/27/24927/1

diff --git a/lint/checkpatch/checkpatch.pl b/lint/checkpatch/checkpatch.pl
index 834b435..7d5c043 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: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210713/ee5c69c8/attachment.htm>


More information about the gerrit-log mailing list