Add a test that uses C++11 features as a compiler canary.
BUG=skia:
R=bungeman@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/568913002
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index 338dbc1..92095ea 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -202,6 +202,7 @@
'-Wno-unused-parameter',
],
'cflags_cc': [
+ '-std=c++11',
'-fno-rtti',
'-Wnon-virtual-dtor',
'-Wno-invalid-offsetof', # GCC <4.6 is old-school strict about what is POD.
@@ -453,8 +454,6 @@
}],
[ 'skia_clang_build', {
'cflags_cc': [
- # Build in C++11 mode to make sure we'll have an easy time switching.
- '-std=c++11',
'-Wno-unknown-warning-option', # Allows unknown warnings.
'-Wno-deprecated', # From Qt, via debugger (older Clang).
'-Wno-deprecated-register', # From Qt, via debugger (newer Clang).
@@ -504,9 +503,10 @@
'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
}],
],
- 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES', # -mssse3
- 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', # -fvisibility=hidden
- 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'NO', # -fvisibility-inlines-hidden
+ 'CLANG_CXX_LANGUAGE_STANDARD': 'c++0x', # -std=c++11
+ 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES', # -mssse3
+ 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', # -fvisibility=hidden
+ 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'NO', # -fvisibility-inlines-hidden
'WARNING_CFLAGS': [
'-Wall',
'-Wextra',
@@ -546,6 +546,7 @@
},
'xcode_settings': {
'ARCHS': ['armv7'],
+ 'CLANG_CXX_LANGUAGE_STANDARD': 'c++0x', # -std=c++11
'CODE_SIGNING_REQUIRED': 'NO',
'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
diff --git a/gyp/tests.gypi b/gyp/tests.gypi
index cf78e41..e1dde57 100644
--- a/gyp/tests.gypi
+++ b/gyp/tests.gypi
@@ -72,6 +72,7 @@
'../tests/ColorFilterTest.cpp',
'../tests/ColorPrivTest.cpp',
'../tests/ColorTest.cpp',
+ '../tests/Cpp11Test.cpp',
'../tests/DashPathEffectTest.cpp',
'../tests/DataRefTest.cpp',
'../tests/DeferredCanvasTest.cpp',
diff --git a/tests/Cpp11Test.cpp b/tests/Cpp11Test.cpp
new file mode 100644
index 0000000..627c4d4
--- /dev/null
+++ b/tests/Cpp11Test.cpp
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "Test.h"
+
+DEF_TEST(Cpp11, r) {
+ auto square = [](int x){ return x*x; };
+
+ REPORTER_ASSERT(r, square(4) == 16);
+}