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