From 80b84d4c268b75994524b00db7a1437b070e98a8 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Fri, 4 Oct 2013 21:14:44 +0000 Subject: G M: Provides the _LIBCPP_WARNING macro, to be used for MSVC only, since that compiler doesn't support #warning. llvm-svn: 191980 --- libcxx/include/__config | 3 +++ libcxx/include/__undef_min_max | 8 ++++++++ libcxx/include/ext/hash_map | 6 +++++- libcxx/include/ext/hash_set | 6 +++++- 4 files changed, 21 insertions(+), 2 deletions(-) (limited to 'libcxx/include') diff --git a/libcxx/include/__config b/libcxx/include/__config index dead4c69935..b0d4a7bc92f 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -79,6 +79,9 @@ # endif # if defined(_MSC_VER) && !defined(__clang__) # define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler +# define _LIBCPP_TOSTRING2(x) #x +# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) +# define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x)) # endif # // If mingw not explicitly detected, assume using MS C runtime only. # ifndef __MINGW32__ diff --git a/libcxx/include/__undef_min_max b/libcxx/include/__undef_min_max index b1e80d1b049..2b6bc90a125 100644 --- a/libcxx/include/__undef_min_max +++ b/libcxx/include/__undef_min_max @@ -9,11 +9,19 @@ //===----------------------------------------------------------------------===// #ifdef min +#if defined(_MSC_VER) && ! defined(__clang__) +_LIBCPP_WARNING("macro min is incompatible with C++. #undefing min") +#else #warning: macro min is incompatible with C++. #undefing min +#endif #undef min #endif #ifdef max +#if defined(_MSC_VER) && ! defined(__clang__) +_LIBCPP_WARNING("macro max is incompatible with C++. #undefing max") +#else #warning: macro max is incompatible with C++. #undefing max +#endif #undef max #endif diff --git a/libcxx/include/ext/hash_map b/libcxx/include/ext/hash_map index b57ea533bc3..225b72baa2c 100644 --- a/libcxx/include/ext/hash_map +++ b/libcxx/include/ext/hash_map @@ -206,7 +206,11 @@ template #include #if __DEPRECATED -#warning Use of the header is deprecated. Migrate to +#if defined(_MSC_VER) && ! defined(__clang__) + _LIBCPP_WARNING("Use of the header is deprecated. Migrate to ") +#else +# warning Use of the header is deprecated. Migrate to +#endif #endif #pragma GCC system_header diff --git a/libcxx/include/ext/hash_set b/libcxx/include/ext/hash_set index deffcb61b06..c4bb89843d5 100644 --- a/libcxx/include/ext/hash_set +++ b/libcxx/include/ext/hash_set @@ -199,7 +199,11 @@ template #include #if __DEPRECATED -#warning Use of the header is deprecated. Migrate to +#if defined(_MSC_VER) && ! defined(__clang__) + _LIBCPP_WARNING("Use of the header is deprecated. Migrate to ") +#else +# warning Use of the header is deprecated. Migrate to +#endif #endif namespace __gnu_cxx { -- cgit v1.2.3