Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933750AbcJTISK (ORCPT ); Thu, 20 Oct 2016 04:18:10 -0400 Received: from mail-lf0-f45.google.com ([209.85.215.45]:36690 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932300AbcJTISH (ORCPT ); Thu, 20 Oct 2016 04:18:07 -0400 Subject: Re: [PATCH] checkpatch: don't match against empty $const_structs To: Joe Perches , Andy Whitcroft , linux-kernel@vger.kernel.org References: <1476951126-30414-1-git-send-email-jerome.forissier@linaro.org> <1476951388.21931.0.camel@perches.com> From: Jerome Forissier Message-ID: Date: Thu, 20 Oct 2016 10:18:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <1476951388.21931.0.camel@perches.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1134 Lines: 35 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 >> --- >> 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" . >>