Debian Codegraph @

libcxx/include/__log_hardening_failure

raw
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
10 #ifndef _LIBCPP___LOG_HARDENING_FAILURE
11 #define _LIBCPP___LOG_HARDENING_FAILURE
12
13 #include <__config>
14
15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16 # pragma GCC system_header
17 #endif
18
19 // Hardening logging is not available in the C++03 mode; moreover, it is currently only available in the experimental
20 // library.
21 #if _LIBCPP_HAS_EXPERIMENTAL_HARDENING_OBSERVE_SEMANTIC && !defined(_LIBCPP_CXX03_LANG)
22
23 _LIBCPP_BEGIN_NAMESPACE_STD
24
25 // This function should never be called directly from the code -- it should only be called through the
26 // `_LIBCPP_LOG_HARDENING_FAILURE` macro.
27 [[__gnu__::__cold__]] _LIBCPP_EXPORTED_FROM_ABI void __log_hardening_failure(const char* __message) noexcept;
28
29 // _LIBCPP_LOG_HARDENING_FAILURE(message)
30 //
31 // This macro is used to log an error without terminating the program (as is the case for hardening failures if the
32 // `observe` assertion semantic is used).
33
34 # if !defined(_LIBCPP_LOG_HARDENING_FAILURE)
35 # define _LIBCPP_LOG_HARDENING_FAILURE(__message) ::std::__log_hardening_failure(__message)
36 # endif // !defined(_LIBCPP_LOG_HARDENING_FAILURE)
37
38 _LIBCPP_END_NAMESPACE_STD
39
40 #endif // _LIBCPP_HAS_EXPERIMENTAL_HARDENING_OBSERVE_SEMANTIC && !defined(_LIBCPP_CXX03_LANG)
41
42 #endif // _LIBCPP___LOG_HARDENING_FAILURE