diff options
| author | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-07-12 14:39:13 +0000 |
|---|---|---|
| committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-07-12 14:39:13 +0000 |
| commit | 6fe307334f4eabbb780870c1b566881cb4631e16 (patch) | |
| tree | 0e12593b6c0ba85e3ef264a81b6b4f0c6790db80 /libcxx | |
| parent | 92aa427bb864fe7494cf81766ecc988a025112f1 (diff) | |
| download | bcm5719-llvm-6fe307334f4eabbb780870c1b566881cb4631e16.tar.gz bcm5719-llvm-6fe307334f4eabbb780870c1b566881cb4631e16.zip | |
Add option to disable __deallocate #warning
From r229162:
Visual Studio's SAL extension uses a macro named __deallocate. This
macro is used pervasively
Using -Werror when building for Windows can force the use of -Wno-#warnings
specifically because of this __deallocate #warning. Instead of forcing
builds to disable all #warnings, this option allows libc++ to be built
without this particular warning, while leaving other #warnings enabled.
Patch by Dave Lee!
llvm-svn: 275172
Diffstat (limited to 'libcxx')
| -rw-r--r-- | libcxx/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | libcxx/include/__undef___deallocate | 2 | ||||
| -rw-r--r-- | libcxx/include/__undef_min_max | 4 |
3 files changed, 10 insertions, 0 deletions
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index c25b48f9f3b..d618e8358ca 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -135,6 +135,7 @@ option(LIBCXX_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread AP # about #include_next which is used everywhere. option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." OFF) option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) +option(LIBCXX_DISABLE_MACRO_CONFLICT_WARNINGS "Disable #warnings about conflicting macros." OFF) option(LIBCXX_GENERATE_COVERAGE "Enable generating code coverage." OFF) set(LIBCXX_COVERAGE_LIBRARY "" CACHE STRING @@ -323,6 +324,9 @@ endif() if (LIBCXX_ENABLE_PEDANTIC) add_compile_flags_if_supported(-pedantic) endif() +if (LIBCXX_DISABLE_MACRO_CONFLICT_WARNINGS) + add_definitions(-D_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) +endif() # Exception flags ============================================================= if (LIBCXX_ENABLE_EXCEPTIONS) diff --git a/libcxx/include/__undef___deallocate b/libcxx/include/__undef___deallocate index 2b4ad99dad3..52f4d9987e2 100644 --- a/libcxx/include/__undef___deallocate +++ b/libcxx/include/__undef___deallocate @@ -9,10 +9,12 @@ //===----------------------------------------------------------------------===// #ifdef __deallocate +#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) #if defined(_MSC_VER) && !defined(__clang__) _LIBCPP_WARNING("macro __deallocate is incompatible with C++. #undefining __deallocate") #else #warning: macro __deallocate is incompatible with C++. #undefining __deallocate #endif +#endif #undef __deallocate #endif diff --git a/libcxx/include/__undef_min_max b/libcxx/include/__undef_min_max index 5df9412c64f..d3c31388cea 100644 --- a/libcxx/include/__undef_min_max +++ b/libcxx/include/__undef_min_max @@ -9,21 +9,25 @@ //===----------------------------------------------------------------------===// #ifdef min +#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) #if defined(_MSC_VER) && ! defined(__clang__) _LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX " "before any Windows header. #undefing min") #else #warning: macro min is incompatible with C++. #undefing min #endif +#endif #undef min #endif #ifdef max +#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) #if defined(_MSC_VER) && ! defined(__clang__) _LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX " "before any Windows header. #undefing max") #else #warning: macro max is incompatible with C++. #undefing max #endif +#endif #undef max #endif |

