summaryrefslogtreecommitdiffstats
path: root/core/config_sanitizers.mk
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-04-16 16:21:02 -0700
committerDan Albert <danalbert@google.com>2015-04-17 09:39:12 -0700
commit27ccb75af78f2fe9bf05f9141b5470fd3c0eeeba (patch)
tree4e547f68309976bfbee43a0b2a3a0dd98d240479 /core/config_sanitizers.mk
parent1ff61a9b2d169477b476fdf4f03a92388f3ba444 (diff)
downloadbuild-27ccb75af78f2fe9bf05f9141b5470fd3c0eeeba.zip
build-27ccb75af78f2fe9bf05f9141b5470fd3c0eeeba.tar.gz
build-27ccb75af78f2fe9bf05f9141b5470fd3c0eeeba.tar.bz2
Clean up sanitizer configuration.
* Refactor a few pieces to avoid deeply nested conditionals. * LOCAL_SANITIZE := never replaces LOCAL_ADDRESS_SANITIZER := false. Change-Id: I68bb8c5edda6ecd40179c5ba9f18d06e96aaa260
Diffstat (limited to 'core/config_sanitizers.mk')
-rw-r--r--core/config_sanitizers.mk29
1 files changed, 23 insertions, 6 deletions
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index 3c07f69..e7a516e 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -4,16 +4,20 @@
# Configure SANITIZE_HOST.
ifdef LOCAL_IS_HOST_MODULE
-ifeq ($(SANITIZE_HOST),true)
-ifneq ($(strip $(LOCAL_CLANG)),false)
-ifneq ($(strip $(LOCAL_ADDRESS_SANITIZER)),false)
- LOCAL_SANITIZE := address
-endif
+ my_sanitize_host := $(strip $(SANITIZE_HOST))
endif
+
+# SANTIZIZE_HOST=true is a deprecated way to say SANITIZE_HOST=address.
+ifeq ($(my_sanitize_host),true)
+ my_sanitize_host := address
endif
+
+# `LOCAL_CLANG := false` disables SANITIZE_HOST.
+ifeq ($(my_clang),false)
+ my_sanitize_host :=
endif
-my_sanitize := $(LOCAL_SANITIZE)
+my_sanitize := $(strip $(LOCAL_SANITIZE))
# Keep compatibility for LOCAL_ADDRESS_SANITIZER until all targets have moved to
# `LOCAL_SANITIZE := address`.
@@ -21,8 +25,21 @@ ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true)
my_sanitize += address
endif
+# And `LOCAL_SANITIZE := never`.
+ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),false)
+ my_sanitize := never
+endif
+
# Don't apply sanitizers to NDK code.
ifdef LOCAL_SDK_VERSION
+ my_sanitize := never
+endif
+
+ifeq ($(my_sanitize),)
+ my_sanitize := $(my_sanitize_host)
+endif
+
+ifeq ($(my_sanitize),never)
my_sanitize :=
endif