* [PATCH] checkpatch: don't match against empty $const_structs
@ 2016-10-20 8:12 Jerome Forissier
2016-10-20 8:16 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Jerome Forissier @ 2016-10-20 8:12 UTC (permalink / raw)
To: Andy Whitcroft, Joe Perches, linux-kernel; +Cc: Jerome Forissier
When $conststructsfile does not exist or is empty, we may get false
warnings such as:
WARNING: struct should normally be const
Fix that by not running the string match if $const_structs is empty.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
---
scripts/checkpatch.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a8368d1..722a319 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6010,7 +6010,8 @@ sub process {
}
# check for various structs that are normally const (ops, kgdb, device_tree)
- if ($line !~ /\bconst\b/ &&
+ if ($const_structs ne "" &&
+ $line !~ /\bconst\b/ &&
$line =~ /\bstruct\s+($const_structs)\b/) {
WARN("CONST_STRUCT",
"struct $1 should normally be const\n" .
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] checkpatch: don't match against empty $const_structs
2016-10-20 8:12 [PATCH] checkpatch: don't match against empty $const_structs Jerome Forissier
@ 2016-10-20 8:16 ` Joe Perches
2016-10-20 8:18 ` Jerome Forissier
0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2016-10-20 8:16 UTC (permalink / raw)
To: Jerome Forissier, Andy Whitcroft, linux-kernel
On Thu, 2016-10-20 at 10:12 +0200, Jerome Forissier wrote:
> When $conststructsfile does not exist or is empty, we may get false
> warnings such as:
> WARNING: struct should normally be const
>
> Fix that by not running the string match if $const_structs is empty.
Why should $const_structs ever be empty?
> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
> ---
> scripts/checkpatch.pl | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index a8368d1..722a319 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -6010,7 +6010,8 @@ sub process {
> }
>
> # check for various structs that are normally const (ops, kgdb, device_tree)
> - if ($line !~ /\bconst\b/ &&
> + if ($const_structs ne "" &&
> + $line !~ /\bconst\b/ &&
> $line =~ /\bstruct\s+($const_structs)\b/) {
> WARN("CONST_STRUCT",
> "struct $1 should normally be const\n" .
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] checkpatch: don't match against empty $const_structs
2016-10-20 8:16 ` Joe Perches
@ 2016-10-20 8:18 ` Jerome Forissier
2016-10-20 8:25 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Jerome Forissier @ 2016-10-20 8:18 UTC (permalink / raw)
To: Joe Perches, Andy Whitcroft, linux-kernel
On 10/20/2016 10:16 AM, Joe Perches wrote:
> On Thu, 2016-10-20 at 10:12 +0200, Jerome Forissier wrote:
>> When $conststructsfile does not exist or is empty, we may get false
>> warnings such as:
>> WARNING: struct should normally be const
>>
>> Fix that by not running the string match if $const_structs is empty.
>
> Why should $const_structs ever be empty?
When running out-of-tree, i.e., using checkpatch.pl on non-kernel sources.
>
>> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
>> ---
>> scripts/checkpatch.pl | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index a8368d1..722a319 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -6010,7 +6010,8 @@ sub process {
>> }
>>
>> # check for various structs that are normally const (ops, kgdb, device_tree)
>> - if ($line !~ /\bconst\b/ &&
>> + if ($const_structs ne "" &&
>> + $line !~ /\bconst\b/ &&
>> $line =~ /\bstruct\s+($const_structs)\b/) {
>> WARN("CONST_STRUCT",
>> "struct $1 should normally be const\n" .
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] checkpatch: don't match against empty $const_structs
2016-10-20 8:18 ` Jerome Forissier
@ 2016-10-20 8:25 ` Joe Perches
0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2016-10-20 8:25 UTC (permalink / raw)
To: Jerome Forissier; +Cc: Andy Whitcroft, linux-kernel
On Thu, 2016-10-20 at 10:18 +0200, Jerome Forissier wrote:
> On 10/20/2016 10:16 AM, Joe Perches wrote
> . Why should $const_structs ever be empty?
> When running out-of-tree, i.e., using checkpatch.pl on non-kernel sources.
Oh, alright.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-10-20 8:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-20 8:12 [PATCH] checkpatch: don't match against empty $const_structs Jerome Forissier
2016-10-20 8:16 ` Joe Perches
2016-10-20 8:18 ` Jerome Forissier
2016-10-20 8:25 ` Joe Perches
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®