Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8359e6e0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Relax cflag checks for -Xclang and -target*" into main

parents 07bceec1 7c4a40a2
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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