lkml.org 
[lkml]   [2016]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] checkpatch: don't match against empty $const_structs
From
Date


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" .
>>

\
 
 \ /
  Last update: 2016-10-20 10:18    [W:0.030 / U:2.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site