Message ID | 20240112221947.1950503-1-willmcvicker@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-25064-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp472904dyc; Fri, 12 Jan 2024 14:20:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGWdlrjfEmTlEJmJHccDHmbTkoQ1PTqZ+l5nYRSoOWtX6W/I7ecJ2WHVednWMrCoPM3+HJR X-Received: by 2002:a05:6e02:52f:b0:360:6ede:b635 with SMTP id h15-20020a056e02052f00b003606edeb635mr1887804ils.49.1705098030468; Fri, 12 Jan 2024 14:20:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705098030; cv=none; d=google.com; s=arc-20160816; b=uJaT251TBYSrDS0FmuGS/3PY6gbB22H28j19dvMoNyg+uUQLIwcyttb4Tt3kI+E940 98VgvOjwz5nZxYfP1nFVIYXBcPgg6uS4P+dHx1BZyyKEk4bhwpiAAUTOl8rCppJJLPtT n8gqwEYZLUA0siZbQFC9cYYvD7PE4nMuIdrpXWE3Wvl0XvIUPsl5rmL4pv659BTqJDyy d/fiEWWjrRcGClnwu3QsJWUMex+uAk/KScp1ACVLbAX7qSCKXxJyyYiid2vr1l24Os0u mMnKzdejOmQr/qODxW61qJAugUa4urzFmXHktyO/zOMXf8KyUzXrm3Xx99ZZbRKbHH+z LOzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=ksYBhZPLA1Cn7mhQtmBXO13MzYmjYuWLD3WlbMKqULg=; fh=z7plL6oWUXfe6Wvrnbu664miisqCGoaaB+enY5ehlI4=; b=brqu9fTUH6sSOCUWn9rgI8j9c7KmWeWl0raxtluUWX8rRazgPpPuIHm+hOebZYveUO xr++ClsnvQKrc6BYG8eLZUy7v9K9fdutOZyRCjd/PAcCmMz9d4/0OB1w5+otq4FyTsR8 ku9axyk3X4aYLrEpZdcjALv/2EuI48O1CON7pB8+LPfvzJsavNZ/T/xI6sXYi1Lt1F7s SKFfZgMc4/dgOYl3AskYo3e98MparUZWnU6lDKsyaEiGuNMcwvf4W7DkkoCaAL579oSs Ftjsw9sVCKOdsMjyavdFL1NZfWY2tB2fR73c0LR09MPoWSgzyKOQYu25LnsWH1vkT3KO 5MJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=D8IHT6lN; spf=pass (google.com: domain of linux-kernel+bounces-25064-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25064-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s13-20020a65644d000000b005ced4fbe639si4195350pgv.549.2024.01.12.14.20.30 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 14:20:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25064-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=D8IHT6lN; spf=pass (google.com: domain of linux-kernel+bounces-25064-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25064-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 97E962877D1 for <ouuuleilei@gmail.com>; Fri, 12 Jan 2024 22:20:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D19771798A; Fri, 12 Jan 2024 22:19:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="D8IHT6lN" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE78F17727 for <linux-kernel@vger.kernel.org>; Fri, 12 Jan 2024 22:19:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--willmcvicker.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-5f9e5455db1so67397357b3.1 for <linux-kernel@vger.kernel.org>; Fri, 12 Jan 2024 14:19:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705097991; x=1705702791; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=ksYBhZPLA1Cn7mhQtmBXO13MzYmjYuWLD3WlbMKqULg=; b=D8IHT6lNgkyu1IYqrHZryjGx5CpTo/Mg+BadjI7HCKPHhMuXIIWKNWGID49tOArVPN cfFAyG3o+psZW22fQUS7grnjv87XVQjOigpOsWA1ZCsfzX/zOQaEdMAVc83aYJ8Gar+5 sx2bP/fiuMjoh6ll3ONYghFIEEfsr5UBa9TXRtGPDjfze4XfTnAucOqg266r1/bbe2tN uuFQ+3mZTrS+VlZoJVjh42lyFXm8JhZtFqA4PlFwlSE66Ww/+jZS6m767ju/efapfuN6 qKdjlpwvXahcMfu3zS1eNyHrODtsj86cjAlFJeXVslT75XxMwdrweVJimeINUF8iGaHS xJAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705097991; x=1705702791; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ksYBhZPLA1Cn7mhQtmBXO13MzYmjYuWLD3WlbMKqULg=; b=EGBE75DgRzhoMJDV2fx7P9B49F67dPeHjP2vSZI3G7rqmcFhWCESGwltlp0QPNHT97 fQTIL9hCpLSjd3Z1rpmSJbn3U7r6zTC5xhLezdxg0Ri01m+VfLJoWwYn9VyKKncqvR58 vZraRfx9ZVMxIw66jm6tCXT2ioZ9FVFqy3/d4XLKRrxFyTEuBn3e263i9JcSPHskNinA ht55aGCFDh623SLbCeaqHRJDMCrNVtaW8e8UEq/rDBqZrB/jMXXCaPizB9ukN1vJt2vU L5xmq6ic+lLNaFX99ZzupwbmAiBvgLvQEsLeHEtOXiZmdpf7TVraGcJtDD52KMdLX0KX 5kdw== X-Gm-Message-State: AOJu0YyD+OFtd7eYRUrlanAS+EQjrYs272K5vowQLLdwXIx+s2la3kW4 Ya4O9aQbuyp6IEeP9bPCX9gmTKcLHVGAoHvkr9jrZsemtg== X-Received: from wmcvicker.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5ebe]) (user=willmcvicker job=sendgmr) by 2002:a81:7102:0:b0:5fb:914f:207a with SMTP id m2-20020a817102000000b005fb914f207amr793886ywc.6.1705097991021; Fri, 12 Jan 2024 14:19:51 -0800 (PST) Date: Fri, 12 Jan 2024 14:19:46 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.275.g3460e3d667-goog Message-ID: <20240112221947.1950503-1-willmcvicker@google.com> Subject: [PATCH v2] checkpatch: allow build files to reference other build files From: Will McVicker <willmcvicker@google.com> To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>, Dwaipayan Ray <dwaipayanray1@gmail.com>, Lukas Bulwahn <lukas.bulwahn@gmail.com> Cc: linux-kbuild@vger.kernel.org, Will McVicker <willmcvicker@google.com>, kernel-team@android.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787910680141316871 X-GMAIL-MSGID: 1787924872292883426 |
Series |
[v2] checkpatch: allow build files to reference other build files
|
|
Commit Message
William McVicker
Jan. 12, 2024, 10:19 p.m. UTC
Add an exception to the EMBEDDED_FILENAME warning for build files. This
fixes the below warnings where the Kconfig and Makefile files reference
other similarly named build files.
WARNING:EMBEDDED_FILENAME: It's generally not useful to have the filename in the file
#24: FILE: Kconfig:34:
+source "drivers/willmcvicker/Kconfig"
WARNING:EMBEDDED_FILENAME: It's generally not useful to have the filename in the file
#36: FILE: Makefile:667:
+ } > Makefile
Signed-off-by: Will McVicker <willmcvicker@google.com>
---
scripts/checkpatch.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
v2:
- Unwrap commit message lines
- Align and update regex
base-commit: 70d201a40823acba23899342d62bc2644051ad2e
Comments
On Fri, Jan 12, 2024 at 02:19:46PM -0800, Will McVicker wrote: > Add an exception to the EMBEDDED_FILENAME warning for build files. This As far as I can see, your patch fixes only the checkpatch warnings for top-level Makefile and Kconfig (and leaving out top-level Kbuild). Other build files are not affected, right? Kind regards, Nicolas > fixes the below warnings where the Kconfig and Makefile files reference > other similarly named build files. > > WARNING:EMBEDDED_FILENAME: It's generally not useful to have the filename in the file > #24: FILE: Kconfig:34: > +source "drivers/willmcvicker/Kconfig" > > WARNING:EMBEDDED_FILENAME: It's generally not useful to have the filename in the file > #36: FILE: Makefile:667: > + } > Makefile > > Signed-off-by: Will McVicker <willmcvicker@google.com> > --- > scripts/checkpatch.pl | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > v2: > - Unwrap commit message lines > - Align and update regex > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index f8343b34a28b..c2869803e545 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -3785,7 +3785,8 @@ sub process { > } > > # check for embedded filenames > - if ($rawline =~ /^\+.*\b\Q$realfile\E\b/) { > + if ($rawline =~ /^\+.*\b\Q$realfile\E\b/ && > + $realfile !~ /(?:Kconfig|Makefile)/) { > WARN("EMBEDDED_FILENAME", > "It's generally not useful to have the filename in the file\n" . $herecurr); > } > > base-commit: 70d201a40823acba23899342d62bc2644051ad2e > -- > 2.43.0.275.g3460e3d667-goog >
On 01/29/2024, Nicolas Schier wrote: > On Fri, Jan 12, 2024 at 02:19:46PM -0800, Will McVicker wrote: > > Add an exception to the EMBEDDED_FILENAME warning for build files. This > > As far as I can see, your patch fixes only the checkpatch warnings for > top-level Makefile and Kconfig (and leaving out top-level Kbuild). > Other build files are not affected, right? Since $realfile includes the full path, I wasn't able to find a case where this issue happens outside of the top-level build files. The same goes for Kbuild files -- the top-level Kbuild file doesn't include other Kbuild files and the other Kbuild files don't include other Kbuild files within the same directory. If you prefer to protect against this warning in the future, I can include Kbuild as well if you want. Thanks, Will > > Kind regards, > Nicolas > > > > fixes the below warnings where the Kconfig and Makefile files reference > > other similarly named build files. > > > > WARNING:EMBEDDED_FILENAME: It's generally not useful to have the filename in the file > > #24: FILE: Kconfig:34: > > +source "drivers/willmcvicker/Kconfig" > > > > WARNING:EMBEDDED_FILENAME: It's generally not useful to have the filename in the file > > #36: FILE: Makefile:667: > > + } > Makefile > > > > Signed-off-by: Will McVicker <willmcvicker@google.com> > > --- > > scripts/checkpatch.pl | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > v2: > > - Unwrap commit message lines > > - Align and update regex > > > > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > index f8343b34a28b..c2869803e545 100755 > > --- a/scripts/checkpatch.pl > > +++ b/scripts/checkpatch.pl > > @@ -3785,7 +3785,8 @@ sub process { > > } > > > > # check for embedded filenames > > - if ($rawline =~ /^\+.*\b\Q$realfile\E\b/) { > > + if ($rawline =~ /^\+.*\b\Q$realfile\E\b/ && > > + $realfile !~ /(?:Kconfig|Makefile)/) { > > WARN("EMBEDDED_FILENAME", > > "It's generally not useful to have the filename in the file\n" . $herecurr); > > } > > > > base-commit: 70d201a40823acba23899342d62bc2644051ad2e > > -- > > 2.43.0.275.g3460e3d667-goog > >
On Tue, Jan 30, 2024 at 02:19:23PM -0800, William McVicker wrote: > On 01/29/2024, Nicolas Schier wrote: > > On Fri, Jan 12, 2024 at 02:19:46PM -0800, Will McVicker wrote: > > > Add an exception to the EMBEDDED_FILENAME warning for build files. This > > > > As far as I can see, your patch fixes only the checkpatch warnings for > > top-level Makefile and Kconfig (and leaving out top-level Kbuild). > > Other build files are not affected, right? > > Since $realfile includes the full path, I wasn't able to find a case where this > issue happens outside of the top-level build files. The same goes for Kbuild > files -- the top-level Kbuild file doesn't include other Kbuild files and the > other Kbuild files don't include other Kbuild files within the same directory. > If you prefer to protect against this warning in the future, I can include > Kbuild as well if you want. yes, I think it would be more complete if top-level Kbuild is also included. Could you also mention 'top-level' somewhere in the commit message? Thanks and kind regards, Nicolas
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index f8343b34a28b..c2869803e545 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3785,7 +3785,8 @@ sub process { } # check for embedded filenames - if ($rawline =~ /^\+.*\b\Q$realfile\E\b/) { + if ($rawline =~ /^\+.*\b\Q$realfile\E\b/ && + $realfile !~ /(?:Kconfig|Makefile)/) { WARN("EMBEDDED_FILENAME", "It's generally not useful to have the filename in the file\n" . $herecurr); }