From 5ae31ddedcb5f7295a7280f927519464e53ae306 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Fri, 29 Jan 2016 16:51:51 -0800 Subject: [PATCH] Add a global define for non-external code. There are some code policies we want to enforce more strictly, but it's hard to do so for third party code because we have to either carry the diff burden or upstream the patch, and in the latter case the turnaround time for fixes can be problematic, and sometimes upstream won't accept changes (sometimes people just need to win the obfuscated C contest). We define ANDROID_STRICT for any code that we expect to be able to make these policy fixes as we change policies. Change-Id: I15faf62cec1932dd859a082f66942b2606d0ff45 --- core/binary.mk | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/binary.mk b/core/binary.mk index 1c7ffda48e..aab1248598 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -1346,6 +1346,21 @@ my_cflags := $(filter-out $(my_illegal_flags),$(my_cflags)) my_cppflags := $(filter-out $(my_illegal_flags),$(my_cppflags)) my_conlyflags := $(filter-out $(my_illegal_flags),$(my_conlyflags)) +# We can enforce some rules more strictly in the code we own. my_strict +# indicates if this is code that we can be stricter with. If we have rules that +# we want to apply to *our* code (but maybe can't for vendor/device specific +# things), we could extend this to be a ternary value. +my_strict := true +ifneq ($(filter external/%,$(LOCAL_PATH)),) + my_strict := false +endif + +# Can be used to make some annotations stricter for code we can fix (such as +# when we mark functions as deprecated). +ifeq ($(my_strict),true) + my_cflags += -DANDROID_STRICT +endif + $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(my_conlyflags)