forked from HowardHinnant/date
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:
committed by
Howard Hinnant
parent
10ab6ae9e5
commit
5ba1c1ad85
@ -126,6 +126,14 @@ namespace date
|
|||||||
# define NOEXCEPT noexcept
|
# define NOEXCEPT noexcept
|
||||||
#endif
|
#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
|
#ifndef HAS_VOID_T
|
||||||
# if __cplusplus >= 201703
|
# if __cplusplus >= 201703
|
||||||
# define HAS_VOID_T 1
|
# define HAS_VOID_T 1
|
||||||
@ -1030,7 +1038,7 @@ public:
|
|||||||
~save_ostream()
|
~save_ostream()
|
||||||
{
|
{
|
||||||
if ((this->flags_ & std::ios::unitbuf) &&
|
if ((this->flags_ & std::ios::unitbuf) &&
|
||||||
#if __cplusplus >= 201703
|
#if HAS_UNCAUGHT_EXCEPTIONS
|
||||||
std::uncaught_exceptions() == 0 &&
|
std::uncaught_exceptions() == 0 &&
|
||||||
#else
|
#else
|
||||||
!std::uncaught_exception() &&
|
!std::uncaught_exception() &&
|
||||||
|
Reference in New Issue
Block a user