Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3823169ybt; Tue, 30 Jun 2020 11:54:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiJAKPRktBzo/n481ikXPD+1BY7p275CckuPg0EZPxADLI+APiqSdsNRAcIGYu6cfUM/Go X-Received: by 2002:a50:d0dc:: with SMTP id g28mr23724884edf.169.1593542922340; Tue, 30 Jun 2020 11:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593542922; cv=none; d=google.com; s=arc-20160816; b=ZSZwJ5P5qYYgVZSxUd5aO3AecGSc4kRYpxfwccutiqsWOMxT6JXujzuZRUmMpEu4oG IqcLYgquGJKczvYzbN2s73EboTqabOVOoTT69gLAdCqC9zLptmGAM+EQQeC9koWpcTS2 92RFBs6mvCGNznBmspbFt5LIi85hmKS04ejnN1uisfo0A/mwWFZg1ijPyDntcKCK4P2B rCyrxRYoEt9qspWy03ycYrjYJxCu7gbFENsXpG/WPfJWKUw+WOx7yXJo7xfXzYSuiJy3 FfJDvnhXaIS5cxZckhFBmANSCe04UNKKU5KyrHbVx/XT392HW3e/IqjFhgsqUhtdTFWP qKRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=77UK+cZyqyw3gLZiPb/FTe0nbUCTBAqAtX9BzSpsWzY=; b=VAJuAdFPjV8XXsYX/hDBhX/qtj3jGl1gO/5JWABaVwy9OQSWCCgH1LGgUxnEkKxjw/ pgiSBVaw8A/gfIchdqbMIgkdwVULnNTLYaHobhcT2v6nibsPe7Q1wJ1aX9pMjVw+GNbW mYAUhXe1ytp7bealMdaH8bY2Wj61VJowBda7dPWBl98jR02uMag26t+Ma2q1GinrGSFd aaNLaMy1xoC8F8/MZntDEpz8h20VwVQ3BjpmOJKoyzGbkd6r8t6KMIsBU0MBMO79rYmM WxCFBbI0mit19DR5AtYeH8Q377ZlCUNZB8JsBb0b56ngHH8t4u+a/z6zs09mGHrYBZAP 3H3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WxMfdOgv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j8si2148431edt.383.2020.06.30.11.48.19; Tue, 30 Jun 2020 11:48:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WxMfdOgv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390235AbgF3RU5 (ORCPT + 99 others); Tue, 30 Jun 2020 13:20:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390230AbgF3RU4 (ORCPT ); Tue, 30 Jun 2020 13:20:56 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7131BC061755 for ; Tue, 30 Jun 2020 10:20:56 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id e64so16926428iof.12 for ; Tue, 30 Jun 2020 10:20:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=77UK+cZyqyw3gLZiPb/FTe0nbUCTBAqAtX9BzSpsWzY=; b=WxMfdOgvU4fe+nEqZoVfj1tZLcXZ7JB/FVumxjs6J7pPVVm6YdZQoIUAq3a9uT7n36 Wo/Khg/Jz2QflUcvY3eEORKKiY8iOVfoJ2pqUilIYAw+3TiEq7RfIzbI4aPHYKs48D5Q grg+8KOZ5BqAwgWCGwBcsGROj5WVXB9KrIsK0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=77UK+cZyqyw3gLZiPb/FTe0nbUCTBAqAtX9BzSpsWzY=; b=eQ+Ozqte7qPoBmTx9qqikbfR4VVz+FpupK64msqiIs99+6MOm/MQGikLi9V5Fy6aWM 2FBUzpk31pfTWlrPwgdlmkwofUlzV2cAFM8Ab2cFXulEiK/AP+VEASVcTJSdBVx69pxs W0YD+lIikRewi0ctujzq9zdbMebHoyDpPFmQPqfWeCycdmw2lYtjTEqzGLsLpQiYRegi NNYcHudgmgoXYbDK85k78VvHz9WauOssVTFXOjfkynRId5YVSXSC+h9sk2a89AQtdtKm VA3RMRN3d2tw+sFGeDimD7lh6prb7msw2xPvO5OG6zdKF5xvgYTSnwo77fnTmhS5o+zS iluA== X-Gm-Message-State: AOAM53074u8e27UT+UkZVNDFoWeT4KQipSkfKXNfO7dQWqLl+E9+MU7K N4PfO5em9G7NgcWeFcAV3yl1zGiKFvdNPKs4TwKoTg== X-Received: by 2002:a6b:9042:: with SMTP id s63mr23191402iod.195.1593537655556; Tue, 30 Jun 2020 10:20:55 -0700 (PDT) MIME-Version: 1.0 References: <20200630143525.13869-1-quentin@isovalent.com> <39ba164ba44be848feac831f2f21effca92bfc96.camel@perches.com> In-Reply-To: <39ba164ba44be848feac831f2f21effca92bfc96.camel@perches.com> From: Vadim Bendebury Date: Tue, 30 Jun 2020 10:20:19 -0700 Message-ID: Subject: Re: [PATCH] checkpatch: prevent reporting C99_COMMENTS error for SPDX tag in .c file To: Joe Perches Cc: Quentin Monnet , Andy Whitcroft , Andrew Morton , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 30, 2020 at 7:47 AM Joe Perches wrote: > > (adding Vadem Bendebury who added the tolerance test) > > On Tue, 2020-06-30 at 15:35 +0100, Quentin Monnet wrote: > > When checkpatch.pl is invoked with "--ignore C99_COMMENT_TOLERANCE", it > > reports C99-style comments found in the code, by matching on the > > double-slash pattern "//". This includes the leading slashes before the > > SPDX tags that are now used in a majority of C files. > > > > Such tags are commented with the double-slash on purpose, and should not > > trigger errors from checkpatch. Let's ignore them when searching for > > C99-style comments to report. > > > > Signed-off-by: Quentin Monnet > > I think this unnecessary as perhaps those that want no > c99 comments likely _really_ want no c99 comments. > > > --- > > scripts/checkpatch.pl | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > index 3cacc122c528..67f350c580ea 100755 > > --- a/scripts/checkpatch.pl > > +++ b/scripts/checkpatch.pl > > @@ -3983,7 +3983,10 @@ sub process { > > } > > > > # no C99 // comments > > - if ($line =~ m{//}) { > > + if ($line =~ m{//} && > > + !($rawline =~ m{// SPDX-License-Identifier:} && > > + $realfile =~ /\.c$/ && Do I understand this right that with this change in the check would be applied to .c files only? .h files should be included. > > + $realline == $checklicenseline)) { What is the purpose of the above check? > > if (ERROR("C99_COMMENTS", > > "do not use C99 // comments\n" . $herecurr) && > > $fix) { >