linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Alexey Dobriyan <adobriyan@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, apw@canonical.com
Subject: Re: [PATCH] checkpatch.pl: warn against using %Z
Date: Mon, 09 Jan 2017 14:16:18 -0800	[thread overview]
Message-ID: <1484000178.2106.23.camel@perches.com> (raw)
In-Reply-To: <20170109235955.GA6787@avx2>

On Tue, 2017-01-10 at 02:59 +0300, Alexey Dobriyan wrote:
> %Z is going to be removed in favour of %z.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
> 
>  scripts/checkpatch.pl |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5189,6 +5189,12 @@ sub process {
>  				     "\%Ld/%Lu are not-standard C, use %lld/%llu\n" . $herecurr);
>  				last;
>  			}
> +			# check for %Z
> +			if ($string =~ /(?<!%)%[\*\d\.\$]*Z[diouxX]/) {
> +				WARN("PRINTF_Z",
> +				     "%Z is non-standard C, use %z\n" . $herecurr);
> +				last;
> +			}
>  			if ($string =~ /0x%[\*\d\.\$\Llzth]*[udi]/) {
>  				ERROR("PRINTF_0xDECIMAL",
>  				      "Prefixing 0x with decimal output is defective\n" . $herecurr);

Right concept, slightly incorrect implementation.

diouxX isn't necessary, ?<!% isn't necessary either as
there's a s/%%/__/g above it, last; probably isn't a
good idea as a single string could have both %Lu and
%Zu and unrelated, thanks for reminding me, I knew but
forgot to fix, the PRINTF_0xDECIMAL is defective as
there's a requirement that the match string only use
upper case.

      reply	other threads:[~2017-01-09 22:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-03 23:01 [PATCH] lib/vsprintf.c: remove %Z support Alexey Dobriyan
2017-01-04  9:33 ` Andy Shevchenko
2017-01-10  0:05   ` Alexey Dobriyan
2017-01-06  0:07 ` Andrew Morton
2017-01-09 23:59   ` [PATCH] checkpatch.pl: warn against using %Z Alexey Dobriyan
2017-01-09 22:16     ` Joe Perches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1484000178.2106.23.camel@perches.com \
    --to=joe@perches.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).