1 | //===----------------------------------------------------------------------===// |
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 | // Test that the default verbose termination function aborts the program. |
10 | // XFAIL: availability-verbose_abort-missing |
11 | |
12 | #include <__verbose_abort> |
13 | #include <csignal> |
14 | #include <cstdlib> |
15 | |
16 | void signal_handler(int signal) { |
17 | if (signal == SIGABRT) |
18 | std::_Exit(EXIT_SUCCESS); |
19 | std::_Exit(EXIT_FAILURE); |
20 | } |
21 | |
22 | int main(int, char**) { |
23 | if (std::signal(SIGABRT, handler: signal_handler) != SIG_ERR) |
24 | std::__libcpp_verbose_abort("%s" , "foo" ); |
25 | return EXIT_FAILURE; |
26 | } |
27 | |