On Wed, Jan 15, 2025 at 04:25:56PM +0000, James Clark wrote:
Opening and closing tokens can also match on words with common 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.
Closing ones also get expect_fields(1) to ensure nothing other than
whitespace follows.
Signed-off-by: James Clark <james.clark@xxxxxxxxxx>
---
arch/arm64/tools/gen-sysreg.awk | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/arch/arm64/tools/gen-sysreg.awk b/arch/arm64/tools/gen-sysreg.awk
index 1a2afc9fdd42..f2a1732cb1f6 100755
--- a/arch/arm64/tools/gen-sysreg.awk
+++ b/arch/arm64/tools/gen-sysreg.awk
@@ -111,7 +111,7 @@ END {
/^$/ { next }
/^[\t ]*#/ { next }
-/^SysregFields/ && block_current() == "Root" {
+$1 == "SysregFields" && block_current() == "Root" {
Stylistic nit, but could you just do:
/^SysregFields$/ && block_current() == "Root" {
instead? That way the diff is smaller (well, same number of lines) and
you avoid the ugly $1.