From 0c91fa84ff8e5f29dbe3a492fc7898eb1eb63b2a Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Sat, 21 Feb 2015 12:45:26 -0800 Subject: [PATCH] Make some warnings impossible to override. These CFLAGS and CPPFLAGS will always be added last, and are controlled by the build system. This way we can add warnings that users are not allowed to disable. Change-Id: Id71f69249078f62ca2687ecbf764aff0fd3a1c1b --- core/config.mk | 6 ++++++ core/definitions.mk | 8 +++++++- core/product.mk | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/core/config.mk b/core/config.mk index 081c1852cd..94b8968aa9 100644 --- a/core/config.mk +++ b/core/config.mk @@ -118,6 +118,12 @@ COMMON_RELEASE_CFLAGS:= -DNDEBUG -UDEBUG COMMON_GLOBAL_CPPFLAGS:= $(COMMON_GLOBAL_CFLAGS) -Wsign-promo -std=gnu++11 COMMON_RELEASE_CPPFLAGS:= $(COMMON_RELEASE_CFLAGS) +GLOBAL_CFLAGS_NO_OVERRIDE := \ + -Werror=int-to-pointer-cast \ + -Werror=pointer-to-int-cast \ + +GLOBAL_CPPFLAGS_NO_OVERRIDE := + # Set the extensions used for various packages COMMON_PACKAGE_SUFFIX := .zip COMMON_JAVA_PACKAGE_SUFFIX := .jar diff --git a/core/definitions.mk b/core/definitions.mk index 37f7d9d507..9845556205 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -990,6 +990,8 @@ $(hide) $(PRIVATE_CXX) \ $(PRIVATE_CFLAGS) \ $(PRIVATE_CPPFLAGS) \ $(PRIVATE_DEBUG_CFLAGS) \ + $(GLOBAL_CFLAGS_NO_OVERRIDE) \ + $(GLOBAL_CPPFLAGS_NO_OVERRIDE) \ -MD -MF $(patsubst %.o,%.d,$@) -o $@ $< $(transform-d-to-p) endef @@ -1022,7 +1024,11 @@ endef define transform-c-to-o-no-deps @echo "target $(PRIVATE_ARM_MODE) C: $(PRIVATE_MODULE) <= $<" -$(call transform-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_CONLYFLAGS) $(PRIVATE_DEBUG_CFLAGS)) +$(call transform-c-or-s-to-o-no-deps, \ + $(PRIVATE_CFLAGS) \ + $(PRIVATE_CONLYFLAGS) \ + $(PRIVATE_DEBUG_CFLAGS) \ + $(GLOBAL_CFLAGS_NO_OVERRIDE)) endef define transform-s-to-o-no-deps diff --git a/core/product.mk b/core/product.mk index 6bba6b876f..ff65672bee 100644 --- a/core/product.mk +++ b/core/product.mk @@ -266,6 +266,10 @@ _product_stash_var_list += \ WITH_DEXPREOPT \ WITH_DEXPREOPT_BOOT_IMG_ONLY +_product_stash_var_list += \ + GLOBAL_CFLAGS_NO_OVERRIDE \ + GLOBAL_CPPFLAGS_NO_OVERRIDE \ + # # Stash values of the variables in _product_stash_var_list. # $(1): Renamed prefix