2020#include < __cxxabi_config.h>
2121
2222#define _LIBCPPABI_VERSION 15000
23- #define _LIBCXXABI_NORETURN __attribute__ ((noreturn))
23+ #define _LIBCXXABI_NORETURN __attribute__ ((noreturn))
2424#define _LIBCXXABI_ALWAYS_COLD __attribute__ ((cold))
2525
2626#ifdef __cplusplus
2727
2828namespace std {
29- #if defined(_WIN32)
29+ # if defined(_WIN32)
3030class _LIBCXXABI_TYPE_VIS type_info; // forward declaration
31- #else
31+ # else
3232class type_info ; // forward declaration
33- #endif
34- }
35-
33+ # endif
34+ } // namespace std
3635
3736// runtime routines use C calling conventions, but are in __cxxabiv1 namespace
3837namespace __cxxabiv1 {
3938
4039struct __cxa_exception ;
40+ # if defined(__wasm__)
41+ typedef void * (*__libcxxabi_exception_destructor_func)(void *);
42+ # else
43+ typedef void (_LIBCXXABI_DTOR_FUNC* __libcxxabi_exception_destructor_func)(void *);
44+ # endif
4145
42- extern " C" {
46+ extern " C" {
4347
4448// 2.4.2 Allocating the Exception Object
45- extern _LIBCXXABI_FUNC_VIS void *
46- __cxa_allocate_exception (size_t thrown_size) throw();
47- extern _LIBCXXABI_FUNC_VIS void
48- __cxa_free_exception (void *thrown_exception) throw();
49+ extern _LIBCXXABI_FUNC_VIS void * __cxa_allocate_exception (size_t thrown_size) throw();
50+ extern _LIBCXXABI_FUNC_VIS void __cxa_free_exception (void * thrown_exception) throw();
4951// This function is an LLVM extension, which mirrors the same extension in libsupc++ and libcxxrt
50- extern _LIBCXXABI_FUNC_VIS __cxa_exception*
51- __cxa_init_primary_exception ( void * object, std::type_info* tinfo, void (_LIBCXXABI_DTOR_FUNC* dest)( void *) ) throw();
52+ extern _LIBCXXABI_FUNC_VIS __cxa_exception* __cxa_init_primary_exception ( void * object, std::type_info* tinfo,
53+ __libcxxabi_exception_destructor_func ) throw();
5254
5355// 2.4.3 Throwing the Exception Object
54- extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
55- __cxa_throw (void *thrown_exception, std::type_info *tinfo,
56- #ifdef __USING_WASM_EXCEPTIONS__
57- // In Wasm, a destructor returns its argument
58- void *(_LIBCXXABI_DTOR_FUNC *dest)(void *));
59- #else
60- void (_LIBCXXABI_DTOR_FUNC *dest)(void *));
61- #endif
56+ extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_throw (void * thrown_exception, std::type_info* tinfo,
57+ __libcxxabi_exception_destructor_func);
6258
6359// 2.5.3 Exception Handlers
64- extern _LIBCXXABI_FUNC_VIS void *
65- __cxa_get_exception_ptr (void *exceptionObject) throw();
66- extern _LIBCXXABI_FUNC_VIS void *
67- __cxa_begin_catch (void *exceptionObject) throw();
60+ extern _LIBCXXABI_FUNC_VIS void * __cxa_get_exception_ptr (void * exceptionObject) throw();
61+ extern _LIBCXXABI_FUNC_VIS void * __cxa_begin_catch (void * exceptionObject) throw();
6862extern _LIBCXXABI_FUNC_VIS void __cxa_end_catch ();
69- #if defined(_LIBCXXABI_ARM_EHABI)
70- extern _LIBCXXABI_FUNC_VIS bool
71- __cxa_begin_cleanup (void *exceptionObject) throw();
63+ # if defined(_LIBCXXABI_ARM_EHABI)
64+ extern _LIBCXXABI_FUNC_VIS bool __cxa_begin_cleanup (void * exceptionObject) throw();
7265extern _LIBCXXABI_FUNC_VIS void __cxa_end_cleanup ();
73- #endif
74- extern _LIBCXXABI_FUNC_VIS std::type_info * __cxa_current_exception_type ();
66+ # endif
67+ extern _LIBCXXABI_FUNC_VIS std::type_info* __cxa_current_exception_type ();
7568
7669// 2.5.4 Rethrowing Exceptions
7770extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_rethrow ();
7871
7972// 2.6 Auxiliary Runtime APIs
8073extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast (void );
8174extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid (void );
82- extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
83- __cxa_throw_bad_array_new_length (void );
75+ extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_throw_bad_array_new_length (void );
8476
8577// 3.2.6 Pure Virtual Function API
8678extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_pure_virtual (void );
@@ -89,94 +81,75 @@ extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_pure_virtual(void);
8981extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_deleted_virtual (void );
9082
9183// 3.3.2 One-time Construction API
92- #if defined(_LIBCXXABI_GUARD_ABI_ARM)
93- extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD int __cxa_guard_acquire (uint32_t *);
94- extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD void __cxa_guard_release (uint32_t *);
95- extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD void __cxa_guard_abort (uint32_t *);
96- #else
97- extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD int __cxa_guard_acquire (uint64_t *);
98- extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD void __cxa_guard_release (uint64_t *);
99- extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD void __cxa_guard_abort (uint64_t *);
100- #endif
84+ # if defined(_LIBCXXABI_GUARD_ABI_ARM)
85+ extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD int __cxa_guard_acquire (uint32_t *);
86+ extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD void __cxa_guard_release (uint32_t *);
87+ extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD void __cxa_guard_abort (uint32_t *);
88+ # else
89+ extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD int __cxa_guard_acquire (uint64_t *);
90+ extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD void __cxa_guard_release (uint64_t *);
91+ extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD void __cxa_guard_abort (uint64_t *);
92+ # endif
10193
10294// 3.3.3 Array Construction and Destruction API
103- extern _LIBCXXABI_FUNC_VIS void *
104- __cxa_vec_new (size_t element_count, size_t element_size, size_t padding_size,
105- void (*constructor)(void *), void (*destructor)(void *));
106-
107- extern _LIBCXXABI_FUNC_VIS void *
108- __cxa_vec_new2 (size_t element_count, size_t element_size, size_t padding_size,
109- void (*constructor)(void *), void (*destructor)(void *),
110- void *(*alloc)(size_t ), void (*dealloc)(void *));
111-
112- extern _LIBCXXABI_FUNC_VIS void *
113- __cxa_vec_new3 (size_t element_count, size_t element_size, size_t padding_size,
114- void (*constructor)(void *), void (*destructor)(void *),
115- void *(*alloc)(size_t ), void (*dealloc)(void *, size_t ));
116-
117- extern _LIBCXXABI_FUNC_VIS void
118- __cxa_vec_ctor (void *array_address, size_t element_count, size_t element_size,
119- void (*constructor)(void *), void (*destructor)(void *));
120-
121- extern _LIBCXXABI_FUNC_VIS void __cxa_vec_dtor (void *array_address,
122- size_t element_count,
123- size_t element_size,
124- void (*destructor)(void *));
125-
126- extern _LIBCXXABI_FUNC_VIS void __cxa_vec_cleanup (void *array_address,
127- size_t element_count,
128- size_t element_size,
129- void (*destructor)(void *));
130-
131- extern _LIBCXXABI_FUNC_VIS void __cxa_vec_delete (void *array_address,
132- size_t element_size,
133- size_t padding_size,
134- void (*destructor)(void *));
135-
136- extern _LIBCXXABI_FUNC_VIS void
137- __cxa_vec_delete2 (void *array_address, size_t element_size, size_t padding_size,
138- void (*destructor)(void *), void (*dealloc)(void *));
139-
140- extern _LIBCXXABI_FUNC_VIS void
141- __cxa_vec_delete3 (void *__array_address, size_t element_size,
142- size_t padding_size, void (*destructor)(void *),
143- void (*dealloc)(void *, size_t ));
144-
145- extern _LIBCXXABI_FUNC_VIS void
146- __cxa_vec_cctor (void *dest_array, void *src_array, size_t element_count,
147- size_t element_size, void (*constructor)(void *, void *),
148- void (*destructor)(void *));
95+ extern _LIBCXXABI_FUNC_VIS void * __cxa_vec_new (size_t element_count, size_t element_size, size_t padding_size,
96+ void (*constructor)(void *), void (*destructor)(void *));
97+
98+ extern _LIBCXXABI_FUNC_VIS void * __cxa_vec_new2 (size_t element_count, size_t element_size, size_t padding_size,
99+ void (*constructor)(void *), void (*destructor)(void *),
100+ void* (*alloc)(size_t ), void (*dealloc)(void *));
101+
102+ extern _LIBCXXABI_FUNC_VIS void * __cxa_vec_new3 (size_t element_count, size_t element_size, size_t padding_size,
103+ void (*constructor)(void *), void (*destructor)(void *),
104+ void* (*alloc)(size_t ), void (*dealloc)(void *, size_t ));
105+
106+ extern _LIBCXXABI_FUNC_VIS void __cxa_vec_ctor (void * array_address, size_t element_count, size_t element_size,
107+ void (*constructor)(void *), void (*destructor)(void *));
108+
109+ extern _LIBCXXABI_FUNC_VIS void __cxa_vec_dtor (void * array_address, size_t element_count, size_t element_size,
110+ void (*destructor)(void *));
111+
112+ extern _LIBCXXABI_FUNC_VIS void __cxa_vec_cleanup (void * array_address, size_t element_count, size_t element_size,
113+ void (*destructor)(void *));
114+
115+ extern _LIBCXXABI_FUNC_VIS void __cxa_vec_delete (void * array_address, size_t element_size, size_t padding_size,
116+ void (*destructor)(void *));
117+
118+ extern _LIBCXXABI_FUNC_VIS void __cxa_vec_delete2 (void * array_address, size_t element_size, size_t padding_size,
119+ void (*destructor)(void *), void (*dealloc)(void *));
120+
121+ extern _LIBCXXABI_FUNC_VIS void __cxa_vec_delete3 (void * __array_address, size_t element_size, size_t padding_size,
122+ void (*destructor)(void *), void (*dealloc)(void *, size_t ));
123+
124+ extern _LIBCXXABI_FUNC_VIS void __cxa_vec_cctor (void * dest_array, void * src_array, size_t element_count,
125+ size_t element_size, void (*constructor)(void *, void *),
126+ void (*destructor)(void *));
149127
150128// 3.3.5.3 Runtime API
151129// These functions are part of the C++ ABI, but they are not defined in libc++abi:
152130// int __cxa_atexit(void (*)(void *), void *, void *);
153131// void __cxa_finalize(void *);
154132
155133// 3.4 Demangler API
156- extern _LIBCXXABI_FUNC_VIS char *__cxa_demangle (const char *mangled_name,
157- char *output_buffer,
158- size_t *length, int *status);
134+ extern _LIBCXXABI_FUNC_VIS char * __cxa_demangle (const char * mangled_name, char * output_buffer, size_t * length,
135+ int * status);
159136
160137// Apple additions to support C++ 0x exception_ptr class
161138// These are primitives to wrap a smart pointer around an exception object
162- extern _LIBCXXABI_FUNC_VIS void *__cxa_current_primary_exception () throw();
163- extern _LIBCXXABI_FUNC_VIS void
164- __cxa_rethrow_primary_exception (void *primary_exception);
165- extern _LIBCXXABI_FUNC_VIS void
166- __cxa_increment_exception_refcount (void *primary_exception) throw();
167- extern _LIBCXXABI_FUNC_VIS void
168- __cxa_decrement_exception_refcount (void *primary_exception) throw();
139+ extern _LIBCXXABI_FUNC_VIS void * __cxa_current_primary_exception () throw();
140+ extern _LIBCXXABI_FUNC_VIS void __cxa_rethrow_primary_exception (void * primary_exception);
141+ extern _LIBCXXABI_FUNC_VIS void __cxa_increment_exception_refcount (void * primary_exception) throw();
142+ extern _LIBCXXABI_FUNC_VIS void __cxa_decrement_exception_refcount (void * primary_exception) throw();
169143
170144// Apple extension to support std::uncaught_exception()
171145extern _LIBCXXABI_FUNC_VIS bool __cxa_uncaught_exception () throw();
172146extern _LIBCXXABI_FUNC_VIS unsigned int __cxa_uncaught_exceptions () throw();
173147
174- #if defined(__linux__) || defined(__Fuchsia__)
148+ # if defined(__linux__) || defined(__Fuchsia__)
175149// Linux and Fuchsia TLS support. Not yet an official part of the Itanium ABI.
176150// https://sourceware.org/glibc/wiki/Destructor%20support%20for%20thread_local%20variables
177- extern _LIBCXXABI_FUNC_VIS int __cxa_thread_atexit (void (*)(void *), void *,
178- void *) throw();
179- #endif
151+ extern _LIBCXXABI_FUNC_VIS int __cxa_thread_atexit (void (*)(void *), void*, void*) throw();
152+ # endif
180153
181154} // extern "C"
182155} // namespace __cxxabiv1
0 commit comments