Conditionally disable -Wno-unused-but-set-variable for gcc-4.6.
We used to do that unconditionally but that caused lots of spurious
warnings in gcc-4.4.x about an unrecognized gcc option.
Change-Id: Idb5118b069871859e07a7efa04914ab6ed0b1372
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index 9748187..8c89143 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -114,6 +114,13 @@
-include $(android_config_h) \
-I $(arch_include_dir)
+# This warning causes dalvik not to build with gcc 4.6 and -Werror.
+# We cannot turn it off blindly since the option is not available
+# in gcc-4.4.x
+ifneq ($(filter 4.6.0%, $(shell $(TARGET_CC) --version)),)
+TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable
+endif
+
# This is to avoid the dreaded warning compiler message:
# note: the mangling of 'va_list' has changed in GCC 4.4
#
diff --git a/core/config.mk b/core/config.mk
index 0951777..c4f08fd 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -102,11 +102,6 @@
# list of flags to turn specific warnings in to errors
TARGET_ERROR_FLAGS := -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point
-# Temporarily turn off Wunsed-but-set-variables warning in gcc-4.6
-# since this warning becomes an error in dalvik, core and renderscript.
-# This is ignored by gcc-4.4.x.
-TARGET_ERROR_FLAGS += -Wno-unused-but-set-variable
-
# TODO: do symbol compression
TARGET_COMPRESS_MODULE_SYMBOLS := false