Revision: 22875
Author: [email protected]
Date: Tue Aug 5 13:23:55 2014 UTC
Log: Enable C++11. Synch toolchains with Chrome.
* Consistently enable C++11 features on all platforms.
* Use the same ARM toolchain version as Chrome.
* Make clang the default on Mac OS X, just like Chrome.
* Use C99 on Mac OS X, again following Chrome.
* Small build fixes.
[email protected]
Review URL: https://codereview.chromium.org/440663002
http://code.google.com/p/v8/source/detail?r=22875
Modified:
/branches/bleeding_edge/Makefile.android
/branches/bleeding_edge/build/android.gypi
/branches/bleeding_edge/build/standalone.gypi
/branches/bleeding_edge/src/base/platform/platform-posix.cc
/branches/bleeding_edge/src/json-parser.h
/branches/bleeding_edge/test/cctest/test-utils.cc
=======================================
--- /branches/bleeding_edge/Makefile.android Tue Jul 1 09:40:14 2014 UTC
+++ /branches/bleeding_edge/Makefile.android Tue Aug 5 13:23:55 2014 UTC
@@ -51,7 +51,7 @@
DEFINES += arm_neon=0 arm_version=7
TOOLCHAIN_ARCH = arm-linux-androideabi
TOOLCHAIN_PREFIX = $(TOOLCHAIN_ARCH)
- TOOLCHAIN_VER = 4.6
+ TOOLCHAIN_VER = 4.8
else
ifeq ($(ARCH), android_arm64)
DEFINES = target_arch=arm64 v8_target_arch=arm64
android_target_arch=arm64 android_target_platform=L
=======================================
--- /branches/bleeding_edge/build/android.gypi Fri Jul 18 11:36:40 2014 UTC
+++ /branches/bleeding_edge/build/android.gypi Tue Aug 5 13:23:55 2014 UTC
@@ -75,7 +75,12 @@
}, # Release
}, # configurations
'cflags': [ '-Wno-abi', '-Wall', '-W', '-Wno-unused-parameter',
- '-Wnon-virtual-dtor', '-fno-rtti', '-fno-exceptions', ],
+ '-Wnon-virtual-dtor', '-fno-rtti', '-fno-exceptions',
+ # Note: Using -std=c++0x will define __STRICT_ANSI__,
which in
+ # turn will leave out some template stuff for 'long long'.
What
+ # we want is -std=c++11, but this is not supported by GCC
4.6 or
+ # Xcode 4.2
+ '-std=gnu++0x' ],
'target_conditions': [
['_toolset=="target"', {
'cflags!': [
=======================================
--- /branches/bleeding_edge/build/standalone.gypi Wed Jul 23 13:14:26 2014
UTC
+++ /branches/bleeding_edge/build/standalone.gypi Tue Aug 5 13:23:55 2014
UTC
@@ -33,7 +33,6 @@
'includes': ['toolchain.gypi'],
'variables': {
'component%': 'static_library',
- 'clang%': 0,
'asan%': 0,
'tsan%': 0,
'visibility%': 'hidden',
@@ -117,6 +116,11 @@
}, {
'v8_enable_gdbjit%': 0,
}],
+ ['OS=="mac"', {
+ 'clang%': 1,
+ }, {
+ 'clang%': 0,
+ }],
],
# Default ARM variable settings.
'arm_version%': 'default',
@@ -214,12 +218,9 @@
'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
'-Wno-long-long', '-pthread', '-fno-exceptions',
'-pedantic' ],
- 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti' ],
+ 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-std=gnu++0x' ],
'ldflags': [ '-pthread', ],
'conditions': [
- [ 'OS=="linux"', {
- 'cflags': [ '-ansi' ],
- }],
[ 'visibility=="hidden" and v8_enable_backtrace==0', {
'cflags': [ '-fvisibility=hidden' ],
}],
@@ -235,7 +236,7 @@
'target_defaults': {
'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
'-fno-exceptions' ],
- 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti' ],
+ 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-std=gnu++0x' ],
'conditions': [
[ 'visibility=="hidden"', {
'cflags': [ '-fvisibility=hidden' ],
@@ -333,7 +334,7 @@
'target_defaults': {
'xcode_settings': {
'ALWAYS_SEARCH_USER_PATHS': 'NO',
- 'GCC_C_LANGUAGE_STANDARD': 'ansi', # -ansi
+ 'GCC_C_LANGUAGE_STANDARD': 'c99', # -std=c99
'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
# (Equivalent to -fPIC)
@@ -369,7 +370,7 @@
['clang==1', {
'xcode_settings': {
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
- 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++11', # -std=gnu++11
+ 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x', # -std=gnu++0x
},
}],
],
=======================================
--- /branches/bleeding_edge/src/base/platform/platform-posix.cc Mon Aug 4
11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/base/platform/platform-posix.cc Tue Aug 5
13:23:55 2014 UTC
@@ -515,7 +515,7 @@
: data_(new PlatformData),
stack_size_(options.stack_size()),
start_semaphore_(NULL) {
- if (stack_size_ > 0 && stack_size_ < PTHREAD_STACK_MIN) {
+ if (stack_size_ > 0 && static_cast<size_t>(stack_size_) <
PTHREAD_STACK_MIN) {
stack_size_ = PTHREAD_STACK_MIN;
}
set_name(options.name());
=======================================
--- /branches/bleeding_edge/src/json-parser.h Tue Aug 5 08:18:22 2014 UTC
+++ /branches/bleeding_edge/src/json-parser.h Tue Aug 5 13:23:55 2014 UTC
@@ -719,7 +719,8 @@
} while (c0 != '"');
int length = position - position_;
uint32_t hash = (length <= String::kMaxHashCalcLength)
- ? StringHasher::GetHashCore(running_hash) : length;
+ ? StringHasher::GetHashCore(running_hash)
+ : static_cast<uint32_t>(length);
Vector<const uint8_t> string_vector(
seq_source_->GetChars() + position_, length);
StringTable* string_table = isolate()->heap()->string_table();
=======================================
--- /branches/bleeding_edge/test/cctest/test-utils.cc Mon Jun 30 13:25:46
2014 UTC
+++ /branches/bleeding_edge/test/cctest/test-utils.cc Tue Aug 5 13:23:55
2014 UTC
@@ -27,6 +27,8 @@
#include <stdlib.h>
+#include <vector>
+
#include "src/v8.h"
#include "src/base/platform/platform.h"
@@ -218,3 +220,40 @@
CHECK_EQ(0, strncmp("0123456789012345678901234567890123",
seq.start(), seq.length()));
}
+
+
+// TODO(svenpanne) Unconditionally test this when our infrastructure is
fixed.
+#if !V8_CC_MSVC
+TEST(CPlusPlus11Features) {
+ struct S {
+ bool x;
+ struct T {
+ double y;
+ int z[3];
+ } t;
+ };
+ S s{true, {3.1415, {1, 2, 3}}};
+ CHECK_EQ(2, s.t.z[1]);
+
+// TODO(svenpanne) Remove the old-skool code when we ship the new C++
headers.
+#if 0
+ std::vector<int> vec{11, 22, 33, 44};
+#else
+ std::vector<int> vec;
+ vec.push_back(11);
+ vec.push_back(22);
+ vec.push_back(33);
+ vec.push_back(44);
+#endif
+ vec.push_back(55);
+ vec.push_back(66);
+ for (auto& i : vec) {
+ ++i;
+ }
+ int j = 12;
+ for (auto i : vec) {
+ CHECK_EQ(j, i);
+ j += 11;
+ }
+}
+#endif
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.