llvm-project
33 строки · 1.0 Кб
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// UNSUPPORTED: no-threads
10// REQUIRES: linux
11
12#include <assert.h>
13#include <cxxabi.h>
14
15static bool AtexitImplCalled = false;
16
17extern "C" int __cxa_thread_atexit_impl(void (*dtor)(void *), void *obj,
18void *dso_symbol) {
19assert(dtor == reinterpret_cast<void (*)(void *)>(1));
20assert(obj == reinterpret_cast<void *>(2));
21assert(dso_symbol == reinterpret_cast<void *>(3));
22AtexitImplCalled = true;
23return 4;
24}
25
26int main(int, char**) {
27int RV = __cxxabiv1::__cxa_thread_atexit(
28reinterpret_cast<void (*)(void *)>(1), reinterpret_cast<void *>(2),
29reinterpret_cast<void *>(3));
30assert(RV == 4);
31assert(AtexitImplCalled);
32return 0;
33}
34