From 651f8286b1322f0745596bb6a1b43fbd1cfc9d47 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Fri, 13 Feb 2015 20:29:57 +0800 Subject: [PATCH] Attempt to fix g++-4.6 build Remove fake std::nullptr_t implementation --- CMakeLists.txt | 8 ++++---- format.h | 22 +++------------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d765423a..3b2abc80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,7 +122,7 @@ endif () check_cxx_source_compiles(" int main(){int*p=nullptr;}" FMT_NULLPTR) if (FMT_NULLPTR) - add_definitions(-DFMT_USE_NULLPTR=1) +# add_definitions(-DFMT_USE_NULLPTR=1) endif () check_cxx_source_compiles(" @@ -133,14 +133,14 @@ check_cxx_source_compiles(" }; int main(){}" FMT_DELETED_FUNCTIONS) if (FMT_DELETED_FUNCTIONS) - add_definitions(-DFMT_USE_DELETED_FUNCTIONS=1) +# add_definitions(-DFMT_USE_DELETED_FUNCTIONS=1) endif () check_cxx_source_compiles(" void f() noexcept {} int main(){ f(); }" FMT_BASIC_NOEXCEPT_SUPPORT) if (FMT_BASIC_NOEXCEPT_SUPPORT) - add_definitions(-DFMT_USE_NOEXCEPT=1) +# add_definitions(-DFMT_USE_NOEXCEPT=1) endif () check_cxx_source_compiles(" @@ -157,7 +157,7 @@ check_cxx_source_compiles(" MoveOnly c(MoveOnly()); }" FMT_RVALUE_REFERENCES) if (FMT_RVALUE_REFERENCES) - add_definitions(-DFMT_USE_RVALUE_REFERENCES=1) +# add_definitions(-DFMT_USE_RVALUE_REFERENCES=1) endif () # GTest doesn't detect with clang. diff --git a/format.h b/format.h index a837f6a1..1a6ff0e6 100644 --- a/format.h +++ b/format.h @@ -137,25 +137,9 @@ || (FMT_GCC_VERSION >= 406 && __cplusplus >= 201103L)\ || (_MSC_VER >= 1600) // Use nullptr -#else -// Simulate it -namespace std { -class nullptr_t { -public: - template - operator T*() const { - return 0; - } - template - operator T C::*() const { - return 0; - } -private: - void operator&() const; -}; -} - -std::nullptr_t const nullptr = {}; +#elif !defined(nullptr) +// Some standard library implementations define nullptr themselves such as libc++ +# define nullptr 0 #endif namespace fmt {