cc: Filter out unknown clang cflags from InstructionSetFlags
-funswitch-loops is in the arm instruction set flags, but unsupported by
clang. Make removes clang unknown cflags from the instruction set flags.
This was producing a warning, causing -Werror to fail on libm.
Change-Id: Ibc69c9af04a738aa8adeb5549900e2b53ab754f0
diff --git a/cc/cc.go b/cc/cc.go
index 2278ec0..c4e1d0e 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -488,15 +488,6 @@
}...)
}
- instructionSet := c.Properties.Instruction_set
- instructionSetFlags, err := toolchain.InstructionSetFlags(instructionSet)
- if err != nil {
- ctx.ModuleErrorf("%s", err)
- }
-
- // TODO: debug
- flags.CFlags = append(flags.CFlags, c.Properties.Release.Cflags...)
-
if !ctx.ContainsProperty("clang") {
if ctx.Host() {
flags.Clang = true
@@ -507,6 +498,18 @@
}
}
+ instructionSet := c.Properties.Instruction_set
+ instructionSetFlags, err := toolchain.InstructionSetFlags(instructionSet)
+ if flags.Clang {
+ instructionSetFlags, err = toolchain.ClangInstructionSetFlags(instructionSet)
+ }
+ if err != nil {
+ ctx.ModuleErrorf("%s", err)
+ }
+
+ // TODO: debug
+ flags.CFlags = append(flags.CFlags, c.Properties.Release.Cflags...)
+
if flags.Clang {
flags.CFlags = clangFilterUnknownCflags(flags.CFlags)
flags.CFlags = append(flags.CFlags, c.Properties.Clang_cflags...)