diff options
author | Jiyong Park <jiyong@google.com> | 2017-09-26 10:50:54 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2017-10-19 22:39:32 +0900 |
commit | d08b697828315502b34deed28307f6e4663342ec (patch) | |
tree | d93799c41e4483c8bb670c93394e3b9153927d6d /cc/check.go | |
parent | e87ae20e2593015c7d30359311a64ef96b941680 (diff) | |
download | build_soong-d08b697828315502b34deed28307f6e4663342ec.tar.gz build_soong-d08b697828315502b34deed28307f6e4663342ec.tar.bz2 build_soong-d08b697828315502b34deed28307f6e4663342ec.zip |
Allow macro definition with space
cflags: ["-DMACRO=\" definition \""] should not be rejected.
Bug: 66914194
Test: TestCompilerFlags in cc_test.go
Change-Id: I7f96505a83898616415ef1fb7e13596b56a063f3
Diffstat (limited to 'cc/check.go')
-rw-r--r-- | cc/check.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cc/check.go b/cc/check.go index d04b1459..4e9e1608 100644 --- a/cc/check.go +++ b/cc/check.go @@ -50,6 +50,11 @@ func CheckBadCompilerFlags(ctx BaseModuleContext, prop string, flags []string) { } else if strings.HasPrefix("../", path) { ctx.PropertyErrorf(prop, "Path must not start with `../`: `%s`. Use include_dirs to -include from a different directory", 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 + // like -DNAME="value with string". Later, this check should be done more + // correctly to prevent multi flag cases like -DNAME=value -O2. } else { ctx.PropertyErrorf(prop, "Bad flag: `%s` is not an allowed multi-word flag. Should it be split into multiple flags?", flag) } |