HAS_UNCAUGHT_EXCEPTIONS definition.

Added some flexibility for usage of std::uncaught_exceptions().
Xcode 10 uses clang and perfectly compiles C++17, but
std::uncaught_exceptions() is available only on iOS 10+ devices. When
application supports iOS 9 devices and uses C++17 there is no way to
build it, except drop iOS 9 support or remove C++17 code. Using this
define we could configure should date.h use std::uncaught_exceptions()
or not.
This commit is contained in:
Evgen Bodunov
2018-09-19 11:30:44 +03:00
committed by Howard Hinnant
parent 10ab6ae9e5
commit 5ba1c1ad85

View File

@ -126,6 +126,14 @@ namespace date
# define NOEXCEPT noexcept
#endif
#ifndef HAS_UNCAUGHT_EXCEPTIONS
# if __cplusplus > 201703
# define HAS_UNCAUGHT_EXCEPTIONS 1
# else
# define HAS_UNCAUGHT_EXCEPTIONS 0
# endif
#endif // HAS_UNCAUGHT_EXCEPTIONS
#ifndef HAS_VOID_T
# if __cplusplus >= 201703
# define HAS_VOID_T 1
@ -1030,7 +1038,7 @@ public:
~save_ostream()
{
if ((this->flags_ & std::ios::unitbuf) &&
#if __cplusplus >= 201703
#if HAS_UNCAUGHT_EXCEPTIONS
std::uncaught_exceptions() == 0 &&
#else
!std::uncaught_exception() &&