Force some clang Werrors that *will* break things.
Clang is really aggressive at optimizing a handful of cases (read:
clang will ruin your day some if you write bad code). Fortunately, it
also emits a warning when it's about to do this.
To prevent anyone from suffering from these optimizations, make these
warnings errors and make them impossible to disable.
Change-Id: I5e10bb0fc2ca23190017da716b3b84635577a0bd
diff --git a/core/definitions.mk b/core/definitions.mk
index db51f94..c1841dc 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1032,8 +1032,8 @@
$(PRIVATE_CFLAGS) \
$(PRIVATE_CPPFLAGS) \
$(PRIVATE_DEBUG_CFLAGS) \
- $(GLOBAL_CFLAGS_NO_OVERRIDE) \
- $(GLOBAL_CPPFLAGS_NO_OVERRIDE) \
+ $(PRIVATE_CFLAGS_NO_OVERRIDE) \
+ $(PRIVATE_CPPFLAGS_NO_OVERRIDE) \
-MD -MF $(patsubst %.o,%.d,$@) -o $@ $<
$(transform-d-to-p)
endef
@@ -1070,7 +1070,7 @@
$(PRIVATE_CFLAGS) \
$(PRIVATE_CONLYFLAGS) \
$(PRIVATE_DEBUG_CFLAGS) \
- $(GLOBAL_CFLAGS_NO_OVERRIDE))
+ $(PRIVATE_CFLAGS_NO_OVERRIDE))
endef
define transform-s-to-o-no-deps
@@ -1137,6 +1137,8 @@
$(PRIVATE_CFLAGS) \
$(PRIVATE_CPPFLAGS) \
$(PRIVATE_DEBUG_CFLAGS) \
+ $(PRIVATE_CFLAGS_NO_OVERRIDE) \
+ $(PRIVATE_CPPFLAGS_NO_OVERRIDE) \
-MD -MF $(patsubst %.o,%.d,$@) -o $@ $<
$(transform-d-to-p)
endef
@@ -1163,6 +1165,7 @@
$(PRIVATE_HOST_GLOBAL_CONLYFLAGS) \
) \
$(1) \
+ $(PRIVATE_CFLAGS_NO_OVERRIDE) \
-MD -MF $(patsubst %.o,%.d,$@) -o $@ $<
endef