xref: /freebsd/contrib/llvm-project/libcxx/include/__verbose_trap (revision 700637cbb5e582861067a11aaca4d053546871d2)
1*700637cbSDimitry Andric// -*- C++ -*-
2*700637cbSDimitry Andric//===----------------------------------------------------------------------===//
3*700637cbSDimitry Andric//
4*700637cbSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*700637cbSDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
6*700637cbSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*700637cbSDimitry Andric//
8*700637cbSDimitry Andric//===----------------------------------------------------------------------===//
9*700637cbSDimitry Andric
10*700637cbSDimitry Andric#ifndef _LIBCPP___VERBOSE_TRAP
11*700637cbSDimitry Andric#define _LIBCPP___VERBOSE_TRAP
12*700637cbSDimitry Andric
13*700637cbSDimitry Andric#include <__config>
14*700637cbSDimitry Andric
15*700637cbSDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16*700637cbSDimitry Andric#  pragma GCC system_header
17*700637cbSDimitry Andric#endif
18*700637cbSDimitry Andric
19*700637cbSDimitry Andric_LIBCPP_BEGIN_NAMESPACE_STD
20*700637cbSDimitry Andric
21*700637cbSDimitry Andric#if __has_builtin(__builtin_verbose_trap)
22*700637cbSDimitry Andric// AppleClang shipped a slightly different version of __builtin_verbose_trap from the upstream
23*700637cbSDimitry Andric// version before upstream Clang actually got the builtin.
24*700637cbSDimitry Andric// TODO: Remove once AppleClang supports the two-arguments version of the builtin.
25*700637cbSDimitry Andric#  if defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1700
26*700637cbSDimitry Andric#    define _LIBCPP_VERBOSE_TRAP(message) __builtin_verbose_trap(message)
27*700637cbSDimitry Andric#  else
28*700637cbSDimitry Andric#    define _LIBCPP_VERBOSE_TRAP(message) __builtin_verbose_trap("libc++", message)
29*700637cbSDimitry Andric#  endif
30*700637cbSDimitry Andric#else
31*700637cbSDimitry Andric#  define _LIBCPP_VERBOSE_TRAP(message) ((void)message, __builtin_trap())
32*700637cbSDimitry Andric#endif
33*700637cbSDimitry Andric
34*700637cbSDimitry Andric_LIBCPP_END_NAMESPACE_STD
35*700637cbSDimitry Andric
36*700637cbSDimitry Andric#endif // _LIBCPP___VERBOSE_TRAP
37