From f6fbaac34c697d5b056dde116c2295e9a3f35a15 Mon Sep 17 00:00:00 2001 From: AdityaK Date: Thu, 1 Feb 2024 15:42:56 -0800 Subject: [PATCH] Error on the usage of -target flag Bug: http://b/323415017 Change-Id: I31897ff0101965088280ad9adc7a23a7c190536a --- cc/check.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cc/check.go b/cc/check.go index 58ff5b2ad..32d1f069e 100644 --- a/cc/check.go +++ b/cc/check.go @@ -45,6 +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") { + ctx.PropertyErrorf(prop, "Bad flag: `%s`, use the correct target soong rule.", flag) } else if strings.Contains(flag, " ") { args := strings.Split(flag, " ") if args[0] == "-include" {