Skip to content

Commit f4aa0c1

Browse files
committed
Keep the old implementation of the default assertion handler for the
sake of the frozen C++03 mode.
1 parent 522dc93 commit f4aa0c1

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

libcxx/vendor/llvm/default_assertion_handler.in

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,40 @@
2525
# pragma GCC system_header
2626
#endif
2727

28-
#if _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_IGNORE
29-
# define _LIBCPP_ASSERTION_HANDLER(message) ((void)0)
28+
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
29+
30+
// Keep the old implementation that doesn't support assertion semantics for backward compatibility with the frozen C++03
31+
// mode.
32+
# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
33+
# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message)
34+
# else
35+
# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_TRAP(message)
36+
# endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
3037

31-
#elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_OBSERVE
32-
# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_LOG_ERROR(::std::_LogErrorReason::_HardeningFailure, message)
38+
#else
3339

34-
#elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE
35-
# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_TRAP(message)
40+
# if _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_IGNORE
41+
# define _LIBCPP_ASSERTION_HANDLER(message) ((void)0)
3642

37-
#elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_ENFORCE
38-
# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message)
43+
# elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_OBSERVE
44+
# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_LOG_ERROR(::std::_LogErrorReason::_HardeningFailure, message)
3945

40-
#else
46+
# elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE
47+
# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_TRAP(message)
4148

42-
# error _LIBCPP_ASSERTION_SEMANTIC must be set to one of the following values: \
49+
# elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_ENFORCE
50+
# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message)
51+
52+
# else
53+
54+
# error _LIBCPP_ASSERTION_SEMANTIC must be set to one of the following values: \
4355
_LIBCPP_ASSERTION_SEMANTIC_IGNORE, \
4456
_LIBCPP_ASSERTION_SEMANTIC_OBSERVE, \
4557
_LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE, \
4658
_LIBCPP_ASSERTION_SEMANTIC_ENFORCE
4759

48-
#endif // _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_IGNORE
60+
# endif // _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_IGNORE
61+
62+
#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
4963

5064
#endif // _LIBCPP___ASSERTION_HANDLER

0 commit comments

Comments
 (0)