make arch and variant parsing more robust
Post-process the arch and cpu variants to treat the arch name or
"generic" as an empty variant. Filter out extra empty abis. Ignore
empty arches. Print a useful error message when appending properties
fails to find the target field, when an unknown architecture is used, or
when a toolchain has not been implemented for the selected
architecture.
Change-Id: I671d4cd04975f4f29aefc4267b3a624868ce6a75
diff --git a/cc/cc.go b/cc/cc.go
index 575d027..aa10d72 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -409,8 +409,8 @@
hod := ctx.HostOrDevice()
factory := toolchainFactories[hod][arch.ArchType]
if factory == nil {
- panic(fmt.Sprintf("Toolchain not found for %s arch %q",
- hod.String(), arch.String()))
+ ctx.ModuleErrorf("Toolchain not found for %s arch %q", hod.String(), arch.String())
+ return nil
}
return factory(arch.ArchVariant, arch.CpuVariant)
}