From 5ed4a1ab79a13c5e4f51a7aeb8eac888f60f308b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Rombauts?= Date: Wed, 13 Dec 2017 17:18:21 +0100 Subject: [PATCH] nullptr compatibility: special detection for clang --- CMakeLists.txt | 2 +- include/SQLiteCpp/Utils.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a121369..f8b58e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ else (MSVC) set(CPPLINT_ARG_OUTPUT "--output=eclipse") set(CPPCHECK_ARG_TEMPLATE "--template=gcc") # Useful compile flags and extra warnings - add_compile_options(-fstack-protector -Wall -Wextra -Wpedantic -Wno-long-long -Wswitch-enum -Wshadow -Winline) + add_compile_options(-fstack-protector -Wall -Wextra -Wpedantic -Wno-long-long -Wswitch-enum -Wshadow -Winline -Wno-c++0x-compat) if (CMAKE_COMPILER_IS_GNUCXX) # GCC flags if (SQLITECPP_USE_GCOV AND CMAKE_COMPILER_IS_GNUCXX) diff --git a/include/SQLiteCpp/Utils.h b/include/SQLiteCpp/Utils.h index fb8d2ea..83fffaa 100644 --- a/include/SQLiteCpp/Utils.h +++ b/include/SQLiteCpp/Utils.h @@ -30,7 +30,8 @@ #define nullptr NULL #endif // nullptr #endif // _MSC_VER < 1600 -#else // _MSC_VER +#elif defined(__clang__) && __has_feature(cxx_nullptr) // Clang 3.0+ +#else // GCC or older Clang #if (__cplusplus < 201103L) && !defined(__GXX_EXPERIMENTAL_CXX0X__) // before C++11 on GCC4.7 and Visual Studio 2010 #ifndef HAVE_NULLPTR #define HAVE_NULLPTR ///< A macro to avoid double definition of nullptr