__assertion_handler 1013 B

12345678910111213141516171819202122232425262728293031
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef _LIBCPP___ASSERTION_HANDLER
  10. #define _LIBCPP___ASSERTION_HANDLER
  11. #include <__config>
  12. #include <__verbose_abort>
  13. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  14. # pragma GCC system_header
  15. #endif
  16. #if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
  17. # define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message)
  18. #else
  19. // TODO(hardening): use `__builtin_verbose_trap(message)` once that becomes available.
  20. # define _LIBCPP_ASSERTION_HANDLER(message) ((void)message, __builtin_trap())
  21. #endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
  22. #endif // _LIBCPP___ASSERTION_HANDLER