Reviewers: jochen,
Message:
On 2014/08/04 09:02:36, jochen wrote:
https://codereview.chromium.org/440663002/diff/1/build/standalone.gypi
File build/standalone.gypi (right):
https://codereview.chromium.org/440663002/diff/1/build/standalone.gypi#newcode217
build/standalone.gypi:217: 'cflags_cc':
[ '-Wnon-virtual-dtor', '-fno-rtti',
'-std=c++0x' ],
why not c++11?
Because g++-4.6 doesn't know that flag. :-)
Description:
Enable C++11.
Please review this at https://codereview.chromium.org/440663002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+30, -7 lines):
M build/standalone.gypi
M test/cctest/test-utils.cc
Index: build/standalone.gypi
diff --git a/build/standalone.gypi b/build/standalone.gypi
index
1fcb8860b4d10e813358b6360699883ce85f4807..dc07960e4ed6b8530e3257323fb54e6ad3e87506
100644
--- a/build/standalone.gypi
+++ b/build/standalone.gypi
@@ -214,12 +214,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=c++0x' ],
'ldflags': [ '-pthread', ],
'conditions': [
- [ 'OS=="linux"', {
- 'cflags': [ '-ansi' ],
- }],
[ 'visibility=="hidden" and v8_enable_backtrace==0', {
'cflags': [ '-fvisibility=hidden' ],
}],
@@ -235,7 +232,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=c++0x' ],
'conditions': [
[ 'visibility=="hidden"', {
'cflags': [ '-fvisibility=hidden' ],
@@ -333,7 +330,6 @@
'target_defaults': {
'xcode_settings': {
'ALWAYS_SEARCH_USER_PATHS': 'NO',
- 'GCC_C_LANGUAGE_STANDARD': 'ansi', # -ansi
'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
# (Equivalent to -fPIC)
@@ -369,7 +365,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': 'c++0x', # -std=c++0x
},
}],
],
Index: test/cctest/test-utils.cc
diff --git a/test/cctest/test-utils.cc b/test/cctest/test-utils.cc
index
c1dae6484a2d6e0a81217c2f8045d7b0cbf9d7ea..6388a3ec1359208c88da85d58a28b1715bb46ba3
100644
--- a/test/cctest/test-utils.cc
+++ b/test/cctest/test-utils.cc
@@ -27,6 +27,8 @@
#include <stdlib.h>
+#include <vector>
+
#include "src/v8.h"
#include "src/base/platform/platform.h"
@@ -218,3 +220,28 @@ TEST(SequenceCollectorRegression) {
CHECK_EQ(0, strncmp("0123456789012345678901234567890123",
seq.start(), seq.length()));
}
+
+
+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]);
+
+ std::vector<int> vec{11, 22, 33, 44};
+ 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;
+ }
+}
--
--
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.