mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Scott Branden <scott.branden@broadcom.com>
To: Joe Perches <joe@perches.com>, Andy Whitcroft <apw@canonical.com>
Cc: BCM Kernel Feedback <bcm-kernel-feedback-list@broadcom.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] checkpatch: ignore CamelCase for inttypes.h format specifiers
Date: Wed, 10 Jun 2020 16:22:42 -0700	[thread overview]
Message-ID: <88a1d1be-cd31-bbaa-3d8d-d7706fcf5e4f@broadcom.com> (raw)
In-Reply-To: <6e2e2095f1b6839ec78d41233fa8d908d1bd2bbe.camel@perches.com>

Hi Joe,

On 2020-06-10 3:22 p.m., Joe Perches wrote:
> On Wed, 2020-06-10 at 14:48 -0700, Scott Branden wrote:
>> On 2020-06-10 2:09 p.m., Joe Perches wrote:
>>> On Wed, 2020-06-10 at 13:33 -0700, Scott Branden wrote:
>>>> Ignore CamelCase for inttypes.h for fixed integer types format specifiers.
>>>> (ex. PRIx32 for uint32_t).
>>> Personally, I don't like those.
>> Checkpatch is run against a lot of code outside of the linux kernel but
>> following linux coding style.
> I know.  I don't have any strong feeling about this either.
>
> But _this_ checkpatch is specifically for the linux-kernel.
>
> I just don't want to encourage a bunch of uses of these
> somewhat useless defines internal to linux-kernel sources.
It is already used in various code in the linux-kernel tree for tools to 
work properly on different cpu architectures.
Use of inttypes.h does have its place.
So _this_ checkpatch shouldn't be complaining about them in the linux 
repo either?
>> There is nothing personal about this, they are the format specifiers in
>> inttypes.h for fixed width types .
> True.  It's impersonal to me too.
>
>>>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
>>>> @@ -5157,6 +5157,8 @@ sub process {
>>>>    			    $var =~ /[A-Z][a-z]|[a-z][A-Z]/ &&
>>>>    #Ignore Page<foo> variants
>>>>    			    $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
>>>> +#Ignore inttypes.h scanf/printf format specifiers for fixed size integer types
>>>> +			    $var !~ /^(?:PRI|SCN)[dxoui](8|16|32|64|PTR|MAX)?$/ &&
> There are missing format specifiers.
> If this is done, the test should be against a variable
>
> Something like:
>
> our $inttype_format = qr{(?x:
> 		(?:PRI|SCN)
> 		[diouxX]
> 		(?:FAST|LEAST)?
> 		(?:8|16|32|64|MAX|PTR)
> };
>
> btw: what about 24, 48, 96, 128 and 256?
>
>>>>    #Ignore SI style variants like nS, mV and dB
>>>>    #(ie: max_uV, regulator_min_uA_show, RANGE_mA_VALUE)
>>>>    			    $var !~ /^(?:[a-z0-9_]*|[A-Z0-9_]*)?_?[a-z][A-Z](?:_[a-z0-9_]+|_[A-Z0-9_]+)?$/ &&


  reply	other threads:[~2020-06-10 23:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-10 20:33 Scott Branden
2020-06-10 21:09 ` Joe Perches
2020-06-10 21:48   ` Scott Branden
2020-06-10 22:22     ` Joe Perches
2020-06-10 23:22       ` Scott Branden [this message]
2020-06-11  6:01       ` Scott Branden
2020-06-11  6:32         ` Joe Perches

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=88a1d1be-cd31-bbaa-3d8d-d7706fcf5e4f@broadcom.com \
    --to=scott.branden@broadcom.com \
    --cc=apw@canonical.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=joe@perches.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

all inboxes | Powered by JetHome®