Warning, /include/c++/v1/__verbose_abort is written in an unsupported language. File is not indexed.
0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009
0010 #ifndef _LIBCPP___VERBOSE_ABORT
0011 #define _LIBCPP___VERBOSE_ABORT
0012
0013 #include <__config>
0014
0015 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0016 # pragma GCC system_header
0017 #endif
0018
0019 _LIBCPP_BEGIN_NAMESPACE_STD
0020
0021 #if defined(_LIBCPP_VERBOSE_ABORT_NOT_NOEXCEPT)
0022 # define _LIBCPP_VERBOSE_ABORT_NOEXCEPT
0023 #else
0024 # define _LIBCPP_VERBOSE_ABORT_NOEXCEPT _NOEXCEPT
0025 #endif
0026
0027 // This function should never be called directly from the code -- it should only be called through
0028 // the _LIBCPP_VERBOSE_ABORT macro.
0029 [[__noreturn__]] _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_ATTRIBUTE_FORMAT(
0030 __printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...) _LIBCPP_VERBOSE_ABORT_NOEXCEPT;
0031
0032 // _LIBCPP_VERBOSE_ABORT(format, args...)
0033 //
0034 // This macro is used to abort the program abnormally while providing additional diagnostic information.
0035 //
0036 // The first argument is a printf-style format string, and the remaining arguments are values to format
0037 // into the format-string. This macro can be customized by users to provide fine-grained control over
0038 // how verbose termination is triggered.
0039 //
0040 // If the user does not supply their own version of the _LIBCPP_VERBOSE_ABORT macro, we pick the default
0041 // behavior based on whether we know the built library we're running against provides support for the
0042 // verbose termination handler or not. If it does, we call it. If it doesn't, we call __builtin_abort to
0043 // make sure that the program terminates but without taking any complex dependencies in this header.
0044 #if !defined(_LIBCPP_VERBOSE_ABORT)
0045
0046 # if !_LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT
0047 // The decltype is there to suppress -Wunused warnings in this configuration.
0048 void __use(const char*, ...);
0049 # define _LIBCPP_VERBOSE_ABORT(...) (decltype(::std::__use(__VA_ARGS__))(), __builtin_abort())
0050 # else
0051 # define _LIBCPP_VERBOSE_ABORT(...) ::std::__libcpp_verbose_abort(__VA_ARGS__)
0052 # endif
0053
0054 #endif // !defined(_LIBCPP_VERBOSE_ABORT)
0055
0056 _LIBCPP_END_NAMESPACE_STD
0057
0058 #endif // _LIBCPP___VERBOSE_ABORT