<p>osmith has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-ci/+/24927">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">lint: checkpatch.pl: complain about %i in printf<br><br>Pau has to remind me often that %d is used instead of %i in Osmocom<br>trees, so let's automate it.<br><br>Complain like this:<br>src/vty/command.c:3052: WARNING:PRINTF_I_OSMO: Use %d instead of %i<br><br>Related: OS#5087<br>Change-Id: I1a98326f1cbf4d2e0bb948558e5cd1726b0a9868<br>---<br>M lint/checkpatch/checkpatch.pl<br>1 file changed, 6 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/27/24927/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/lint/checkpatch/checkpatch.pl b/lint/checkpatch/checkpatch.pl</span><br><span>index 834b435..7d5c043 100755</span><br><span>--- a/lint/checkpatch/checkpatch.pl</span><br><span>+++ b/lint/checkpatch/checkpatch.pl</span><br><span>@@ -6170,6 +6170,7 @@</span><br><span> # check for non-standard and hex prefixed decimal printf formats</span><br><span>          my $show_L = 1; #don't show the same defect twice</span><br><span>                my $show_Z = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+               my $show_i = 1;</span><br><span>              while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) {</span><br><span>                       my $string = substr($rawline, $-[1], $+[1] - $-[1]);</span><br><span>                         $string =~ s/%%/__/g;</span><br><span>@@ -6185,6 +6186,11 @@</span><br><span>                                    "%Z$1 is non-standard C, use %z$1\n" . $herecurr);</span><br><span>                            $show_Z = 0;</span><br><span>                         }</span><br><span style="color: hsl(120, 100%, 40%);">+                     if ($show_i && $string =~ /%[\*\d\.\$]*i/) { # Osmocom specific</span><br><span style="color: hsl(120, 100%, 40%);">+                               WARN("PRINTF_I_OSMO",</span><br><span style="color: hsl(120, 100%, 40%);">+                                    "Use %d instead of %i\n" . $herecurr);</span><br><span style="color: hsl(120, 100%, 40%);">+                         $show_i = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+                  }</span><br><span>                    # check for 0x<decimal></span><br><span>                        if ($string =~ /0x%[\*\d\.\$\Llzth]*[diou]/) {</span><br><span>                               ERROR("PRINTF_0XDECIMAL",</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-ci/+/24927">change 24927</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-ci/+/24927"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-ci </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I1a98326f1cbf4d2e0bb948558e5cd1726b0a9868 </div>
<div style="display:none"> Gerrit-Change-Number: 24927 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>