-
Notifications
You must be signed in to change notification settings - Fork 971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EASTL doesn't detect non-apple clang on MacOS properly - thinks modern clang versions are pre-C++11 #68
Comments
The included EABase package is EASTL's only dependency. It handles defining the necessary compiler and platform defines EASTL uses to configure itself. The necessary EABase header files should be included implicitly by EASTL headers. EA_HAVE_CPP11_INITIALIZER_LIST defined here:
FAQ entry on this: Line 780 in e16f771
Example of an EASTL header including EABase headers: EASTL/include/EASTL/functional.h Line 9 in e16f771
|
in eacompilers.h
is what's killing me. I'm running 3.9 (real clang version, not stupid apple clang version number) downloaded directly from clang's download site: http://llvm.org/releases/download.html Any thoughts on a workaround? Either for my code or for eacompilers.h directly? |
Is your compiler not in at least C++11 mode?
|
I am using c++14 and heavily use c++14 features, so it must be set correct or I'd get all sorts of errors. but if I'm reading this correctly, Because this isn't true (because of the compiler version and APPLE being set) :
it sets:
which then causes this:
to set EA_NO_HAVE_CPP11_INITIALIZER_LIST instead of EA_HAVE_CPP11_INITIALIZER_LIST which then causes this to be false: #if defined(EA_HAVE_CPP11_INITIALIZER_LIST) // If the compiler can generate calls to std::initializer_list... .. causing std::initializer_list to be redefined here:
|
More to the point, I comment out the APPLE test in eacompiler.h and things work as expected. #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(clang) && (EA_COMPILER_VERSION >= 301) // && !defined(APPLE) // Clang 3.1+, not including Apple's Clang. |
I have reason to believe there is a apple_build_version but am double checking. |
A little more documentation is here: https://sourceforge.net/p/predef/wiki/Compilers/ I've been told this is how cmake determine |
Ah, yes this makes sense. EABase figures you are on an Apple platform so you must be using an Apple version of clang. Since you are using clang 3.9 on MacOS it figures you are on an older version of the Apple Clang compiler which doesn't have initializer_lists. Preventing CMake from defining APPLE would force EABase into the non-Apple Clang version checks and everything should work correctly. Not sure if this easily done but internally and on the open source repo we only build/test with Apple's version of Clang on MacOS. This is the best document I've found for mapping between the version numbers: |
I think you could literally to do a text replace of __APPLE__ to __apple_build_version__ and be done. |
Potentially, I'm briefly looked at the Apple docs and they refer to APPLE but not to apple_build_version. We actually don't test this use case internally so if its a popular enough feature we could support it. However we would have to setup the Travis CI infrastructure to validate this use case and ensure we don't regress as future development occurs. If anyone is interested in doing the work I'd be interested in reviewing the PR. |
Potentially look at https://github.com/electronicarts/EASTL/blob/master/scripts/CMake/CommonCppFlags.cmake I might have screwed up the apple flags for clang as I don't have an apple machine. |
on clang 3.9 (and probably others), I have to make sure to have
#define EA_HAVE_CPP11_INITIALIZER_LIST
before I include any eastl headers or I get redefinition of initializer_list. Is this normal?
Searching the eastl source on github for that string, I don't see anywhere it would be set automatically...
Thank you.
The text was updated successfully, but these errors were encountered: