test/codegen: forbid commas as separators

We need to leave the comma in the regexp so we get the entire comment
for processing, but report an error if commas are actually used.

Change-Id: Ia19a329deda2524cea292d866a84d1bf3b4518c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/760780
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Paul Murphy <paumurph@redhat.com>
Auto-Submit: Keith Randall <khr@google.com>
This commit is contained in:
Keith Randall
2026-03-28 08:12:15 -07:00
committed by Gopher Robot
parent 1582ad4105
commit f9d2c2fd69

View File

@@ -1489,7 +1489,6 @@ var (
// "[\s,]+" matches " "
// second reMatchCheck matches "`SUB`"
// ")*)" closes started groups; "*" means that there might be other elements in the space-separated list
// (TODO: remove allowance for comma-separation once the repo is all fixed.)
rxAsmPlatform = regexp.MustCompile(`(\w+)(/[\w.]+)?(/\w*)?\s*:\s*(` + reMatchCheck + `(?:[\s,]+` + reMatchCheck + `)*)`)
// Regexp to extract a single opcoded check
@@ -1685,6 +1684,8 @@ func (t test) wantedAsmOpcodes(fn string) asmChecks {
t.Errorf("%s:%d: possible unused assembly pattern: %v", t.goFileName(), i+1, tail)
} else if strings.Count(comment, "\"")%2 != 0 || strings.Count(comment, "`")%2 != 0 {
t.Errorf("%s:%d: unbalanced quotes: %v", t.goFileName(), i+1, comment)
} else if strings.Contains(comment, "\",") || strings.Contains(comment, "`,") {
t.Errorf("%s:%d: comma separator - use space instead: %v", t.goFileName(), i+1, comment)
}
}
comment = ""