Messages in this thread | | | Subject | Re: [PATCH] checkpatch: ignore CamelCase for inttypes.h format specifiers | From | Scott Branden <> | Date | Wed, 10 Jun 2020 23:01:16 -0700 |
| |
Hi Joe,
A few questions about changes below.
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. > >> 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) > }; I can try adding the "X" and FAST|LEAST. But I am not familiar enough with perl or the checkpatch script to understand what you mean by test should be against a variable vs what I have done. > btw: what about 24, 48, 96, 128 and 256? I can't find those values described for inttypes.h format specifiers. Where are you looking at those values from? > >>>> #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_]+)?$/ &&
| |