]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/thread-local-atexit-macOS.dtest/main.cpp
3 // BUILD: $CXX main.cpp -std=c++11 -o $BUILD_DIR/thread-local-atexit-macOS.exe
5 // RUN: ./thread-local-atexit-macOS.exe
11 #include "test_support.h"
13 // We create an A and a B.
14 // While destroying B we create a C
15 // Given that tlv_finalize has "destroy in reverse order of construction", we
16 // must then immediately destroy C before we destroy A to maintain that invariant
47 if ( state
!= None
) {
48 FAIL("should be in the 'None' state");
54 if ( state
!= ConstructedA
) {
55 FAIL("should be in the 'ConstructedA' state");
61 // We construct C during B's destructor
62 if ( state
!= DestroyingB
) {
63 FAIL("should be in the 'DestroyingB' state");
70 if ( state
!= ConstructedB
) {
71 FAIL("should be in the 'ConstructedB' state");
74 static thread_local C c
;
75 if ( state
!= ConstructedC
) {
76 FAIL("should be in the 'ConstructedC' state");
83 if ( state
!= DestroyedB
) {
84 FAIL("should be in the 'DestroyedB' state");
89 // And finally destroy A
91 if ( state
!= DestroyedC
) {
92 FAIL("should be in the 'DestroyedC' state");
100 thread_local A a
= {};
101 thread_local B b
= {};
104 int main(int argc
, const char* argv
[], const char* envp
[], const char* apple
[]) {