1
0
mirror of https://github.com/golang/go synced 2024-11-18 01:14:48 -07:00

cmd/go: allow passing -U flag in cgo CFLAGS

Fixes #34730
This commit is contained in:
Umang Parmar 2019-10-14 21:11:27 +05:30
parent e4c3925925
commit 43ea8da0b2
2 changed files with 5 additions and 0 deletions

View File

@ -43,6 +43,7 @@ var re = lazyregexp.New
var validCompilerFlags = []*lazyregexp.Regexp{
re(`-D([A-Za-z_].*)`),
re(`-U([A-Za-z_]*)`),
re(`-F([^@\-].*)`),
re(`-I([^@\-].*)`),
re(`-O`),
@ -51,6 +52,7 @@ var validCompilerFlags = []*lazyregexp.Regexp{
re(`-W([^@,]+)`), // -Wall but not -Wa,-foo.
re(`-Wa,-mbig-obj`),
re(`-Wp,-D([A-Za-z_].*)`),
re(`-Wp, -U([A-Za-z_]*)`),
re(`-ansi`),
re(`-f(no-)?asynchronous-unwind-tables`),
re(`-f(no-)?blocks`),
@ -127,6 +129,7 @@ var validCompilerFlags = []*lazyregexp.Regexp{
var validCompilerFlagsWithNextArg = []string{
"-arch",
"-D",
"-U",
"-I",
"-framework",
"-isysroot",

View File

@ -12,6 +12,7 @@ import (
var goodCompilerFlags = [][]string{
{"-DFOO"},
{"-Dfoo=bar"},
{"-Ufoo"},
{"-F/Qt"},
{"-I/"},
{"-I/etc/passwd"},
@ -67,6 +68,7 @@ var goodCompilerFlags = [][]string{
var badCompilerFlags = [][]string{
{"-D@X"},
{"-D-X"},
{"-Ufoo=bar"},
{"-F@dir"},
{"-F-dir"},
{"-I@dir"},