Re-enable thread-safety checking on host, warn when not enabled.
Disable thread safety checks in the interpreter where template specialization
is causing annotalysis issues.
Change-Id: I178ea278a93a3eb90f386b3e02827b5c61ea0e52
diff --git a/build/Android.common.mk b/build/Android.common.mk
index 508ff1b..f6a1300 100644
--- a/build/Android.common.mk
+++ b/build/Android.common.mk
@@ -62,13 +62,6 @@
-Wstrict-aliasing=3 \
-fstrict-aliasing
-# Enable thread-safety for GCC 4.6 but not for GCC 4.7 where this feature was removed.
-# Enable GCC 4.6 builds with 'export TARGET_GCC_VERSION_EXP=4.6'
-ifneq ($(filter 4.6 4.6.%, $(TARGET_GCC_VERSION)),)
- $(info Enabling thread-safety for GCC $(TARGET_GCC_VERSION))
- art_cflags += -Wthread-safety
-endif
-
ifeq ($(ART_SMALL_MODE),true)
art_cflags += -DART_SMALL_MODE=1
endif
@@ -108,6 +101,19 @@
ART_TARGET_CFLAGS += -DANDROID_SMP=0
endif
+# Enable thread-safety for GCC 4.6 on the target but not for GCC 4.7 where this feature was removed.
+ifneq ($(filter 4.6 4.6.%, $(TARGET_GCC_VERSION)),)
+ ART_TARGET_CFLAGS += -Wthread-safety
+else
+ # Warn if not using GCC 4.6 for target builds when not doing a top-level or 'mma' build.
+ ifneq ($(ONE_SHOT_MAKEFILE),)
+ # Enable target GCC 4.6 with: export TARGET_GCC_VERSION_EXP=4.6
+ $(info Using target GCC $(TARGET_GCC_VERSION) disables thread-safety checks.)
+ endif
+endif
+# We build with GCC 4.6 on the host.
+ART_HOST_CFLAGS += -Wthread-safety
+
# To use oprofile_android --callgraph, uncomment this and recompile with "mmm art -B -j16"
# ART_TARGET_CFLAGS += -fno-omit-frame-pointer -marm -mapcs