|
| 1 | +//===-- Implementation for abort_handler_s ----------------------*- C++ -*-===// |
| 2 | +// |
| 3 | +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | +// See https://llvm.org/LICENSE.txt for license information. |
| 5 | +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | +// |
| 7 | +//===----------------------------------------------------------------------===// |
| 8 | + |
| 9 | +#ifndef LLVM_LIBC_SRC___SUPPORT_ANNEX_K_ABORT_HANDLER_S_H |
| 10 | +#define LLVM_LIBC_SRC___SUPPORT_ANNEX_K_ABORT_HANDLER_S_H |
| 11 | + |
| 12 | +#include "hdr/stdio_macros.h" |
| 13 | +#include "hdr/types/errno_t.h" |
| 14 | +#include "src/__support/OSUtil/io.h" |
| 15 | +#include "src/__support/common.h" |
| 16 | +#include "src/stdlib/abort.h" |
| 17 | + |
| 18 | +namespace LIBC_NAMESPACE_DECL { |
| 19 | + |
| 20 | +namespace annex_k { |
| 21 | + |
| 22 | +LIBC_INLINE static void abort_handler_s(const char *__restrict msg, |
| 23 | + [[maybe_unused]] void *__restrict ptr, |
| 24 | + [[maybe_unused]] errno_t error) { |
| 25 | + write_to_stderr("abort_handler_s was called in response to a " |
| 26 | + "runtime-constraint violation.\n\n"); |
| 27 | + |
| 28 | + if (msg) |
| 29 | + write_to_stderr(msg); |
| 30 | + |
| 31 | + write_to_stderr( |
| 32 | + "\n\nNote to end users: This program was terminated as a result\ |
| 33 | +of a bug present in the software. Please reach out to your\ |
| 34 | +software's vendor to get more help.\n"); |
| 35 | + |
| 36 | + abort(); |
| 37 | +} |
| 38 | + |
| 39 | +} // namespace annex_k |
| 40 | + |
| 41 | +} // namespace LIBC_NAMESPACE_DECL |
| 42 | + |
| 43 | +#endif // LLVM_LIBC_SRC___SUPPORT_ANNEX_K_ABORT_HANDLER_S_H |
0 commit comments