mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-02 08:26:29 +00:00
Build fix: Turn off _GLIBCXX_DEBUG based on a compile check
Summary: Enabling _GLIBCXX_DEBUG (implied by LLVM_ENABLE_EXPENSIVE_CHECKS) causes std::min_element (and presumably others) to no longer be constexpr, which in turn causes the build to fail. This seems like a bug in the GCC STL. This change works around it. Change-Id: I5fc471caa9c4de3ef4e87aeeac8df1b960e8e72c Reviewers: tstellar, hans, serge-sans-paille Differential Revision: https://reviews.llvm.org/D75199
This commit is contained in:
parent
ad41630f22
commit
b3943e6777
@ -77,7 +77,22 @@ endif()
|
||||
|
||||
if(LLVM_ENABLE_EXPENSIVE_CHECKS)
|
||||
add_definitions(-DEXPENSIVE_CHECKS)
|
||||
add_definitions(-D_GLIBCXX_DEBUG)
|
||||
|
||||
# In some libstdc++ versions, std::min_element is not constexpr when
|
||||
# _GLIBCXX_DEBUG is enabled.
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#define _GLIBCXX_DEBUG
|
||||
#include <algorithm>
|
||||
int main(int argc, char** argv) {
|
||||
static constexpr int data[] = {0, 1};
|
||||
constexpr const int* min_elt = std::min_element(&data[0], &data[2]);
|
||||
return 0;
|
||||
}" CXX_SUPPORTS_GLIBCXX_DEBUG)
|
||||
if(CXX_SUPPORTS_GLIBCXX_DEBUG)
|
||||
add_definitions(-D_GLIBCXX_DEBUG)
|
||||
else()
|
||||
add_definitions(-D_GLIBCXX_ASSERTIONS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(TOUPPER "${LLVM_ABI_BREAKING_CHECKS}" uppercase_LLVM_ABI_BREAKING_CHECKS)
|
||||
|
Loading…
Reference in New Issue
Block a user