summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2013-08-12 17:41:54 -0700
committerMathieu Chartier <mathieuc@google.com>2013-08-13 14:21:12 -0700
commit9b3c3cdb62f7142384e6bf2c0cb6e3a76b16f0e3 (patch)
treeee468053902f5d58bd0037000bc7031ea77175b2
parent7b67bee4f6ca4e634f35f63d1e08e1b05f138e01 (diff)
downloadart-9b3c3cdb62f7142384e6bf2c0cb6e3a76b16f0e3.tar.gz
art-9b3c3cdb62f7142384e6bf2c0cb6e3a76b16f0e3.tar.bz2
art-9b3c3cdb62f7142384e6bf2c0cb6e3a76b16f0e3.zip
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
-rw-r--r--build/Android.common.mk4
-rw-r--r--compiler/llvm/runtime_support_builder_thumb2.cc4
-rw-r--r--runtime/base/logging.h7
-rw-r--r--runtime/check_jni.cc2
-rw-r--r--runtime/gc/accounting/card_table.h2
5 files changed, 11 insertions, 8 deletions
diff --git a/build/Android.common.mk b/build/Android.common.mk
index 82097250f9..786b1de06c 100644
--- a/build/Android.common.mk
+++ b/build/Android.common.mk
@@ -110,6 +110,7 @@ ART_C_INCLUDES := \
art_cflags := \
-fno-rtti \
-O2 \
+ -std=gnu++11 \
-ggdb3 \
-Wall \
-Werror \
@@ -125,9 +126,6 @@ ifeq ($(ART_SEA_IR_MODE),true)
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 f0cb4a2d7b..eff29c8b04 100644
--- a/compiler/llvm/runtime_support_builder_thumb2.cc
+++ b/compiler/llvm/runtime_support_builder_thumb2.cc
@@ -51,8 +51,8 @@ void RuntimeSupportBuilderThumb2::EmitLockObject(Value* object) {
// $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 eafa050f9c..ade8d34ed6 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(const signed char*, signed char*);
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 089e306586..073d67b823 100644
--- a/runtime/check_jni.cc
+++ b/runtime/check_jni.cc
@@ -912,7 +912,7 @@ class ScopedCheck {
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 f03062607d..a1936de2b1 100644
--- a/runtime/gc/accounting/card_table.h
+++ b/runtime/gc/accounting/card_table.h
@@ -47,7 +47,7 @@ class CardTable {
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);