C++11 support for ART.

We can now use auto, ranged based loops, etc..
This compiles, the phone boots, and the tests pass.

Depends on:
https://googleplex-android-review.googlesource.com/#/c/342487/

Change-Id: I8ba8ed47d2118e4711668c9c8f973a67beb261b2
diff --git a/build/Android.common.mk b/build/Android.common.mk
index 8209725..786b1de 100644
--- a/build/Android.common.mk
+++ b/build/Android.common.mk
@@ -110,6 +110,7 @@
 art_cflags := \
 	-fno-rtti \
 	-O2 \
+	-std=gnu++11 \
 	-ggdb3 \
 	-Wall \
 	-Werror \
@@ -125,9 +126,6 @@
   art_cflags += -DART_SEA_IR_MODE=1
 endif
 
-# TODO: enable -std=gnu++0x for auto support when on Ubuntu 12.04 LTS (Precise Pangolin)
-# On 10.04 LTS (Lucid Lynx), it can cause dependencies on GLIBCXX_3.4.14 version symbols.
-
 ifeq ($(HOST_OS),linux)
   art_non_debug_cflags := \
 	-Wframe-larger-than=1728
diff --git a/compiler/llvm/runtime_support_builder_thumb2.cc b/compiler/llvm/runtime_support_builder_thumb2.cc
index f0cb4a2..eff29c8 100644
--- a/compiler/llvm/runtime_support_builder_thumb2.cc
+++ b/compiler/llvm/runtime_support_builder_thumb2.cc
@@ -51,8 +51,8 @@
   // $2: temp
   // $3: temp
   std::string asms;
-  StringAppendF(&asms, "add $3, $1, #%"PRId32"\n", mirror::Object::MonitorOffset().Int32Value());
-  StringAppendF(&asms, "ldr $2, [r9, #%"PRId32"]\n", Thread::ThinLockIdOffset().Int32Value());
+  StringAppendF(&asms, "add $3, $1, #%" PRId32 "\n", mirror::Object::MonitorOffset().Int32Value());
+  StringAppendF(&asms, "ldr $2, [r9, #%" PRId32 "]\n", Thread::ThinLockIdOffset().Int32Value());
   StringAppendF(&asms, "ldrex $0, [$3]\n");
   StringAppendF(&asms, "lsl $2, $2, %d\n", LW_LOCK_OWNER_SHIFT);
   StringAppendF(&asms, "bfi $2, $0, #0, #%d\n", LW_LOCK_OWNER_SHIFT - 1);
diff --git a/runtime/base/logging.h b/runtime/base/logging.h
index eafa050..ade8d34 100644
--- a/runtime/base/logging.h
+++ b/runtime/base/logging.h
@@ -32,7 +32,7 @@
         << "Check failed: " #x << " "
 
 #define CHECK_OP(LHS, RHS, OP) \
-  for (::art::EagerEvaluator<typeof(LHS), typeof(RHS)> _values(LHS, RHS); \
+  for (auto _values = ::art::MakeEagerEvaluator(LHS, RHS); \
        UNLIKELY(!(_values.lhs OP _values.rhs)); /* empty */) \
     ::art::LogMessage(__FILE__, __LINE__, FATAL, -1).stream() \
         << "Check failed: " << #LHS << " " << #OP << " " << #RHS \
@@ -165,6 +165,11 @@
 EAGER_PTR_EVALUATOR(signed char*, const signed char*);
 EAGER_PTR_EVALUATOR(signed char*, signed char*);
 
+template <typename LHS, typename RHS>
+EagerEvaluator<LHS, RHS> MakeEagerEvaluator(LHS lhs, RHS rhs) {
+  return EagerEvaluator<LHS, RHS>(lhs, rhs);
+}
+
 // This indirection greatly reduces the stack impact of having
 // lots of checks/logging in a function.
 struct LogMessageData {
diff --git a/runtime/check_jni.cc b/runtime/check_jni.cc
index 089e306..073d67b 100644
--- a/runtime/check_jni.cc
+++ b/runtime/check_jni.cc
@@ -912,7 +912,7 @@
   sc.Check(true, types, ##args)
 
 #define CHECK_JNI_EXIT(type, exp) ({ \
-  typeof(exp) _rc = (exp); \
+    auto _rc = (exp); \
   sc.Check(false, type, _rc); \
   _rc; })
 #define CHECK_JNI_EXIT_VOID() \
diff --git a/runtime/gc/accounting/card_table.h b/runtime/gc/accounting/card_table.h
index f030626..a1936de 100644
--- a/runtime/gc/accounting/card_table.h
+++ b/runtime/gc/accounting/card_table.h
@@ -47,7 +47,7 @@
  public:
   static const size_t kCardShift = 7;
   static const size_t kCardSize = (1 << kCardShift);
-  static const uint8_t kCardClean  = 0x0;
+  static const uint8_t kCardClean = 0x0;
   static const uint8_t kCardDirty = 0x70;
 
   static CardTable* Create(const byte* heap_begin, size_t heap_capacity);