brintos

brintos / llvm-project-archived public Read only

0
0
Text · 834 B · 27169da Raw
27 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// Test that the default verbose termination function aborts the program.10// XFAIL: availability-verbose_abort-missing11 12#include <__cxx03/__verbose_abort>13#include <csignal>14#include <cstdlib>15 16void signal_handler(int signal) {17  if (signal == SIGABRT)18    std::_Exit(EXIT_SUCCESS);19  std::_Exit(EXIT_FAILURE);20}21 22int main(int, char**) {23  if (std::signal(SIGABRT, signal_handler) != SIG_ERR)24    std::__libcpp_verbose_abort("%s", "foo");25  return EXIT_FAILURE;26}27