* 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.
R=bmeurer@chromium.org
Review URL: https://codereview.chromium.org/
440663002
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22875
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
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
}, # 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!': [
'includes': ['toolchain.gypi'],
'variables': {
'component%': 'static_library',
- 'clang%': 0,
'asan%': 0,
'tsan%': 0,
'visibility%': 'hidden',
}, {
'v8_enable_gdbjit%': 0,
}],
+ ['OS=="mac"', {
+ 'clang%': 1,
+ }, {
+ 'clang%': 0,
+ }],
],
# Default ARM variable settings.
'arm_version%': 'default',
'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' ],
}],
'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' ],
'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)
['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
},
}],
],
: 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());
} 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();
#include <stdlib.h>
+#include <vector>
+
#include "src/v8.h"
#include "src/base/platform/platform.h"
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