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// This compile-time customization requires cross-file macros, which doesn't work with modules.
10// UNSUPPORTED: clang-modules-build
11
12// Make sure that we can customize the verbose termination function at compile-time by
13// defining _LIBCPP_VERBOSE_ABORT ourselves. Note that this does not have any
14// deployment target requirements.
15
16// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_VERBOSE_ABORT(...)=my_abort(__VA_ARGS__)
17
18#include <cstdlib>
19
20void my_abort(char const*, ...) {
21 std::exit(EXIT_SUCCESS);
22}
23
24int main(int, char**) {
25 _LIBCPP_VERBOSE_ABORT("%s", "message");
26 return EXIT_FAILURE;
27}
28

source code of libcxx/test/libcxx/assertions/customize_verbose_abort.compile-time.pass.cpp