diff options
| author | 2024-07-08 10:50:16 -0700 | |
|---|---|---|
| committer | 2024-07-08 10:50:16 -0700 | |
| commit | 7c4a40a2f611e049f15e69f59df9f6ec7aaf4565 (patch) | |
| tree | c21b6f54a8799a3ce966d2f97c8f8ec08b5a14cb | |
| parent | 6650b15953efe67f723ab9253992dc743ae3c799 (diff) | |
Relax cflag checks for -Xclang and -target*
Allow flags in cflags that start with "-target".
Allow "-Xclang <arg>" in cflags.
Bug: 350058746
Test: builds
Flag: EXEMPT bugfix
Change-Id: I1bf64268047949d747f53d8b111fc26298aee958
| -rw-r--r-- | cc/check.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cc/check.go b/cc/check.go index 32d1f069e..e3af3b288 100644 --- a/cc/check.go +++ b/cc/check.go @@ -45,7 +45,8 @@ func CheckBadCompilerFlags(ctx BaseModuleContext, prop string, flags []string) { ctx.PropertyErrorf(prop, "-Weverything is not allowed in Android.bp files. "+ "Build with `m ANDROID_TEMPORARILY_ALLOW_WEVERYTHING=true` to experiment locally with -Weverything.") } - } else if strings.HasPrefix(flag, "-target") || strings.HasPrefix(flag, "--target") { + } else if strings.HasPrefix(flag, "-target ") || strings.HasPrefix(flag, "--target ") || + strings.HasPrefix(flag, "-target=") || strings.HasPrefix(flag, "--target=") { ctx.PropertyErrorf(prop, "Bad flag: `%s`, use the correct target soong rule.", flag) } else if strings.Contains(flag, " ") { args := strings.Split(flag, " ") @@ -63,6 +64,10 @@ func CheckBadCompilerFlags(ctx BaseModuleContext, prop string, flags []string) { if len(args) > 2 { ctx.PropertyErrorf(prop, "`-mllvm` only takes one argument: `%s`", flag) } + } else if args[0] == "-Xclang" { + if len(args) > 2 { + ctx.PropertyErrorf(prop, "`-Xclang` only takes one argument: `%s`", flag) + } } else if strings.HasPrefix(flag, "-D") && strings.Contains(flag, "=") { // Do nothing in this case. // For now, we allow space characters in -DNAME=def form to allow use cases |