From f3aaa5270047369e4f87db5da5588b2236b05917 Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Wed, 2 May 2018 09:30:35 -0700 Subject: [PATCH] Request std=c++11 dialect again, and add warning (#900) * Put back stdc++11 and add compile-time check * Soften it and update changelog --- CHANGELOG.md | 1 + Source/Base/ASBaseDefines.h | 3 +++ Texture.podspec | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83041497a2..7b171e8d2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ - `ASDisplayNode, ASLayoutSpec, and ASLayoutElementStyle` now conform to `NSLocking`. They act as recursive locks. Useful locking macros have been added as `ASThread.h`. Subclasses / client code can lock these objects but should be careful as usual when dealing with locks. [Adlai Holler](https://github.com/Adlai-Holler) - Introduces `ASRecursiveUnfairLock` as an experiment to improve locking performance. [Adlai Holler](https://github.com/Adlai-Holler) - Adds an experiment to shorten init time. [Adlai Holler](https://github.com/Adlai-Holler) +- Adds a check that Texture is compiled with stdc++11 as specified by the podfile. gnu++11 can cause subtle issues that are currently being investigated. [Adlai Holler](https://github.com/Adlai-Holler) ## 2.6 - [Xcode 9] Updated to require Xcode 9 (to fix warnings) [Garrett Moon](https://github.com/garrettmoon) diff --git a/Source/Base/ASBaseDefines.h b/Source/Base/ASBaseDefines.h index 6706b6da47..4b562e192d 100755 --- a/Source/Base/ASBaseDefines.h +++ b/Source/Base/ASBaseDefines.h @@ -23,6 +23,9 @@ // wrap constants, only C functions. See StackOverflow for more details: // http://stackoverflow.com/questions/1041866/in-c-source-what-is-the-effect-of-extern-c #ifdef __cplusplus +# ifndef __STRICT_ANSI__ + #warning "Texture must be compiled with std=c++11. gnu++ is not supported and may cause issues." +# endif # define ASDISPLAYNODE_EXTERN_C_BEGIN extern "C" { # define ASDISPLAYNODE_EXTERN_C_END } #else diff --git a/Texture.podspec b/Texture.podspec index 7041e82f2f..6fe9a85455 100644 --- a/Texture.podspec +++ b/Texture.podspec @@ -63,4 +63,9 @@ Pod::Spec.new do |spec| spec.social_media_url = 'https://twitter.com/TextureiOS' spec.library = 'c++' + spec.pod_target_xcconfig = { + 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++11', + 'CLANG_CXX_LIBRARY' => 'libc++' + } + end