Merge pull request #197 from neilmacintosh/dev/neilmac/defines

Clean up compiler-config macros.
This commit is contained in:
Neil MacIntosh 2015-11-17 15:46:03 -08:00
commit 7fc95710b6
2 changed files with 25 additions and 6 deletions

View File

@ -39,16 +39,21 @@
#pragma push_macro("constexpr")
#define constexpr /* nothing */
// MSVC has the potential of bringing in headers where max is a macro
#ifdef max
#pragma push_macro("max")
#undef max
#endif
// VS 2013 workarounds
#if _MSC_VER <= 1800
#pragma push_macro("GSL_MSVC_HAS_VARIADIC_CTOR_BUG")
// needed in span.h
#define GSL_MSVC_HAS_VARIADIC_CTOR_BUG
// noexcept is not understood
#ifndef GSL_THROWS_FOR_TESTING
#pragma push_macro("noexcept")
#define noexcept /* nothing */
#endif
@ -63,7 +68,13 @@
// In order to test the library, we need it to throw exceptions that we can catch
#ifdef GSL_THROWS_FOR_TESTING
#ifdef _MSC_VER
#pragma push_macro("noexcept")
#endif
#define noexcept /* nothing */
#endif // GSL_THROWS_FOR_TESTING
@ -2029,28 +2040,38 @@ general_span_iterator<Span> operator+(typename general_span_iterator<Span>::diff
} // namespace gsl
#ifdef _MSC_VER
#undef constexpr
#pragma pop_macro("constexpr")
#ifdef max
#pragma pop_macro("max")
#endif
#if _MSC_VER <= 1800
#pragma warning(pop)
#ifndef GSL_THROWS_FOR_TESTING
#undef noexcept
#pragma pop_macro("noexcept")
#endif // GSL_THROWS_FOR_TESTING
#undef GSL_MSVC_HAS_VARIADIC_CTOR_BUG
#pragma pop_macro("GSL_MSVC_HAS_VARIADIC_CTOR_BUG")
#endif // _MSC_VER <= 1800
#endif // _MSC_VER
#if defined(GSL_THROWS_FOR_TESTING)
#undef noexcept
#ifdef _MSC_VER
#pragma pop_macro("noexcept")
#endif
#endif // GSL_THROWS_FOR_TESTING

View File

@ -26,7 +26,6 @@
#ifdef _MSC_VER
#if _MSC_VER <= 1800
#pragma push_macro("GSL_MSVC_HAS_TYPE_DEDUCTION_BUG")
#define GSL_MSVC_HAS_TYPE_DEDUCTION_BUG
#endif // _MSC_VER <= 1800
@ -217,7 +216,6 @@ using wzstring_builder = basic_zstring_builder<wchar_t, Max>;
#ifdef _MSC_VER
#if _MSC_VER <= 1800
#pragma pop_macro("GSL_MSVC_HAS_TYPE_DEDUCTION_BUG")
#undef GSL_MSVC_HAS_TYPE_DEDUCTION_BUG
#endif // _MSC_VER <= 1800