mirror of
https://github.com/golang/go.git
synced 2025-05-17 21:34:36 +00:00
cmd/go: in cgoflags, permit -DX1, prohibit -Wp,-D,opt
Restrict -D and -U to ASCII C identifiers, but do permit trailing digits. When using -Wp, prohibit commas in -D values. Change-Id: Ibfc4dfdd6e6c258e131448e7682610c44eee9492 Reviewed-on: https://go-review.googlesource.com/c/go/+/267277 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
parent
ecd7b7e991
commit
da7aa86917
@ -42,8 +42,8 @@ import (
|
||||
var re = lazyregexp.New
|
||||
|
||||
var validCompilerFlags = []*lazyregexp.Regexp{
|
||||
re(`-D([A-Za-z_].*)`),
|
||||
re(`-U([A-Za-z_]*)`),
|
||||
re(`-D([A-Za-z_][A-Za-z0-9_]*)(=[^@\-]*)?`),
|
||||
re(`-U([A-Za-z_][A-Za-z0-9_]*)`),
|
||||
re(`-F([^@\-].*)`),
|
||||
re(`-I([^@\-].*)`),
|
||||
re(`-O`),
|
||||
@ -51,8 +51,8 @@ var validCompilerFlags = []*lazyregexp.Regexp{
|
||||
re(`-W`),
|
||||
re(`-W([^@,]+)`), // -Wall but not -Wa,-foo.
|
||||
re(`-Wa,-mbig-obj`),
|
||||
re(`-Wp,-D([A-Za-z_].*)`),
|
||||
re(`-Wp,-U([A-Za-z_]*)`),
|
||||
re(`-Wp,-D([A-Za-z_][A-Za-z0-9_]*)(=[^@,\-]*)?`),
|
||||
re(`-Wp,-U([A-Za-z_][A-Za-z0-9_]*)`),
|
||||
re(`-ansi`),
|
||||
re(`-f(no-)?asynchronous-unwind-tables`),
|
||||
re(`-f(no-)?blocks`),
|
||||
|
@ -13,6 +13,7 @@ var goodCompilerFlags = [][]string{
|
||||
{"-DFOO"},
|
||||
{"-Dfoo=bar"},
|
||||
{"-Ufoo"},
|
||||
{"-Ufoo1"},
|
||||
{"-F/Qt"},
|
||||
{"-I/"},
|
||||
{"-I/etc/passwd"},
|
||||
@ -24,6 +25,8 @@ var goodCompilerFlags = [][]string{
|
||||
{"-Wall"},
|
||||
{"-Wp,-Dfoo=bar"},
|
||||
{"-Wp,-Ufoo"},
|
||||
{"-Wp,-Dfoo1"},
|
||||
{"-Wp,-Ufoo1"},
|
||||
{"-fobjc-arc"},
|
||||
{"-fno-objc-arc"},
|
||||
{"-fomit-frame-pointer"},
|
||||
@ -80,6 +83,8 @@ var badCompilerFlags = [][]string{
|
||||
{"-O@1"},
|
||||
{"-Wa,-foo"},
|
||||
{"-W@foo"},
|
||||
{"-Wp,-DX,-D@X"},
|
||||
{"-Wp,-UX,-U@X"},
|
||||
{"-g@gdb"},
|
||||
{"-g-gdb"},
|
||||
{"-march=@dawn"},
|
||||
|
Loading…
x
Reference in New Issue
Block a user