From: James Clark <james.clark@linaro.org>
To: Marc Zyngier <maz@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org, robh@kernel.org,
broonie@kernel.org, Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Oliver Upton <oliver.upton@linux.dev>,
Anshuman Khandual <anshuman.khandual@arm.com>,
James Morse <james.morse@arm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] arm64/sysreg: Enforce whole line match for closing blocks
Date: Wed, 15 Jan 2025 15:48:30 +0000 [thread overview]
Message-ID: <65eb308e-6851-47b2-8fa8-31b093a0d25e@linaro.org> (raw)
In-Reply-To: <867c6ww49g.wl-maz@kernel.org>
On 15/01/2025 2:17 pm, Marc Zyngier wrote:
> On Wed, 15 Jan 2025 13:42:54 +0000,
> James Clark <james.clark@linaro.org> wrote:
>>
>> Match on the whole line to prevent matching on prefixes like "Endsysreg"
>> vs "EndsysregFields". This could potentially make the script go wrong
>> in weird ways so make it fall through to the fatal unhandled statement
>> catcher if it doesn't fully match the current block.
>>
>> Signed-off-by: James Clark <james.clark@linaro.org>
>> ---
>> arch/arm64/tools/gen-sysreg.awk | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arm64/tools/gen-sysreg.awk b/arch/arm64/tools/gen-sysreg.awk
>> index 1a2afc9fdd42..7c7412adf90e 100755
>> --- a/arch/arm64/tools/gen-sysreg.awk
>> +++ b/arch/arm64/tools/gen-sysreg.awk
>> @@ -127,7 +127,7 @@ END {
>> next
>> }
>>
>> -/^EndSysregFields/ && block_current() == "SysregFields" {
>> +/^EndSysregFields$/ && block_current() == "SysregFields" {
>
> The problem with this sort of things is that it will now fail with
> trailing spaces, which is both counter-intuitive and pretty hard to
> spot.
>
> Why don't you simply match the field number, like you do in patch 3?
>
> M.
>
The intention was to ensure that the end tokens were the only thing on
the line (including whitespace). But yeah it is slightly inconsistent
compared to start tokens because as you mention "$1 ==" allows both
leading and trailing whitespace.
I'll change it to "$1 ==" for end tokens as well and then add
expect_fields(1) which catches unexpected trailing stuff but has a
better warning.
James
next prev parent reply other threads:[~2025-01-15 15:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 13:42 [PATCH 0/5] arm64/sysreg: Sort sysreg by encoding James Clark
2025-01-15 13:42 ` [PATCH 1/5] arm64/sysreg: Fix unbalanced closing block James Clark
2025-01-15 13:42 ` [PATCH 2/5] arm64/sysreg: Enforce whole line match for closing blocks James Clark
2025-01-15 13:47 ` Mark Brown
2025-01-15 14:17 ` Marc Zyngier
2025-01-15 15:48 ` James Clark [this message]
2025-01-15 13:42 ` [PATCH 3/5] arm64/sysreg: Enforce whole word for opening blocks James Clark
2025-01-15 13:42 ` [PATCH 4/5] arm64/sysreg: Sort sysreg by encoding James Clark
2025-01-15 13:42 ` [PATCH 5/5] arm64/sysreg: Enforce sorting James Clark
2025-01-15 14:12 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=65eb308e-6851-47b2-8fa8-31b093a0d25e@linaro.org \
--to=james.clark@linaro.org \
--cc=anshuman.khandual@arm.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=robh@kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®