cxxabi.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. // ABI Support -*- C++ -*-
  2. // Copyright (C) 2000-2019 Free Software Foundation, Inc.
  3. //
  4. // This file is part of GCC.
  5. //
  6. // GCC is free software; you can redistribute it and/or modify
  7. // it under the terms of the GNU General Public License as published by
  8. // the Free Software Foundation; either version 3, or (at your option)
  9. // any later version.
  10. //
  11. // GCC is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU General Public License for more details.
  15. //
  16. // Under Section 7 of GPL version 3, you are granted additional
  17. // permissions described in the GCC Runtime Library Exception, version
  18. // 3.1, as published by the Free Software Foundation.
  19. // You should have received a copy of the GNU General Public License and
  20. // a copy of the GCC Runtime Library Exception along with this program;
  21. // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  22. // <http://www.gnu.org/licenses/>.
  23. // Written by Nathan Sidwell, Codesourcery LLC, <nathan@codesourcery.com>
  24. /* This file declares the new abi entry points into the runtime. It is not
  25. normally necessary for user programs to include this header, or use the
  26. entry points directly. However, this header is available should that be
  27. needed.
  28. Some of the entry points are intended for both C and C++, thus this header
  29. is includable from both C and C++. Though the C++ specific parts are not
  30. available in C, naturally enough. */
  31. /** @file cxxabi.h
  32. * The header provides an interface to the C++ ABI.
  33. */
  34. #ifndef _CXXABI_H
  35. #define _CXXABI_H 1
  36. #pragma GCC system_header
  37. #pragma GCC visibility push(default)
  38. #include <stddef.h>
  39. #include <bits/c++config.h>
  40. #include <bits/cxxabi_tweaks.h>
  41. #include <bits/cxxabi_forced.h>
  42. #include <bits/cxxabi_init_exception.h>
  43. #ifdef __cplusplus
  44. namespace __cxxabiv1
  45. {
  46. extern "C"
  47. {
  48. #endif
  49. typedef __cxa_cdtor_return_type (*__cxa_cdtor_type)(void *);
  50. // Allocate array.
  51. void*
  52. __cxa_vec_new(size_t __element_count, size_t __element_size,
  53. size_t __padding_size, __cxa_cdtor_type __constructor,
  54. __cxa_cdtor_type __destructor);
  55. void*
  56. __cxa_vec_new2(size_t __element_count, size_t __element_size,
  57. size_t __padding_size, __cxa_cdtor_type __constructor,
  58. __cxa_cdtor_type __destructor, void *(*__alloc) (size_t),
  59. void (*__dealloc) (void*));
  60. void*
  61. __cxa_vec_new3(size_t __element_count, size_t __element_size,
  62. size_t __padding_size, __cxa_cdtor_type __constructor,
  63. __cxa_cdtor_type __destructor, void *(*__alloc) (size_t),
  64. void (*__dealloc) (void*, size_t));
  65. // Construct array.
  66. __cxa_vec_ctor_return_type
  67. __cxa_vec_ctor(void* __array_address, size_t __element_count,
  68. size_t __element_size, __cxa_cdtor_type __constructor,
  69. __cxa_cdtor_type __destructor);
  70. __cxa_vec_ctor_return_type
  71. __cxa_vec_cctor(void* __dest_array, void* __src_array,
  72. size_t __element_count, size_t __element_size,
  73. __cxa_cdtor_return_type (*__constructor) (void*, void*),
  74. __cxa_cdtor_type __destructor);
  75. // Destruct array.
  76. void
  77. __cxa_vec_dtor(void* __array_address, size_t __element_count,
  78. size_t __element_size, __cxa_cdtor_type __destructor);
  79. void
  80. __cxa_vec_cleanup(void* __array_address, size_t __element_count, size_t __s,
  81. __cxa_cdtor_type __destructor) _GLIBCXX_NOTHROW;
  82. // Destruct and release array.
  83. void
  84. __cxa_vec_delete(void* __array_address, size_t __element_size,
  85. size_t __padding_size, __cxa_cdtor_type __destructor);
  86. void
  87. __cxa_vec_delete2(void* __array_address, size_t __element_size,
  88. size_t __padding_size, __cxa_cdtor_type __destructor,
  89. void (*__dealloc) (void*));
  90. void
  91. __cxa_vec_delete3(void* __array_address, size_t __element_size,
  92. size_t __padding_size, __cxa_cdtor_type __destructor,
  93. void (*__dealloc) (void*, size_t));
  94. int
  95. __cxa_guard_acquire(__guard*);
  96. void
  97. __cxa_guard_release(__guard*) _GLIBCXX_NOTHROW;
  98. void
  99. __cxa_guard_abort(__guard*) _GLIBCXX_NOTHROW;
  100. // DSO destruction.
  101. int
  102. __cxa_atexit(void (*)(void*), void*, void*) _GLIBCXX_NOTHROW;
  103. int
  104. __cxa_finalize(void*);
  105. // TLS destruction.
  106. int
  107. __cxa_thread_atexit(void (*)(void*), void*, void *) _GLIBCXX_NOTHROW;
  108. // Pure virtual functions.
  109. void
  110. __cxa_pure_virtual(void) __attribute__ ((__noreturn__));
  111. void
  112. __cxa_deleted_virtual(void) __attribute__ ((__noreturn__));
  113. // Exception handling auxiliary.
  114. void
  115. __cxa_bad_cast() __attribute__((__noreturn__));
  116. void
  117. __cxa_bad_typeid() __attribute__((__noreturn__));
  118. void
  119. __cxa_throw_bad_array_new_length() __attribute__((__noreturn__));
  120. /**
  121. * @brief Demangling routine.
  122. * ABI-mandated entry point in the C++ runtime library for demangling.
  123. *
  124. * @param __mangled_name A NUL-terminated character string
  125. * containing the name to be demangled.
  126. *
  127. * @param __output_buffer A region of memory, allocated with
  128. * malloc, of @a *__length bytes, into which the demangled name is
  129. * stored. If @a __output_buffer is not long enough, it is
  130. * expanded using realloc. @a __output_buffer may instead be NULL;
  131. * in that case, the demangled name is placed in a region of memory
  132. * allocated with malloc.
  133. *
  134. * @param __length If @a __length is non-null, the length of the
  135. * buffer containing the demangled name is placed in @a *__length.
  136. *
  137. * @param __status If @a __status is non-null, @a *__status is set to
  138. * one of the following values:
  139. * 0: The demangling operation succeeded.
  140. * -1: A memory allocation failure occurred.
  141. * -2: @a mangled_name is not a valid name under the C++ ABI mangling rules.
  142. * -3: One of the arguments is invalid.
  143. *
  144. * @return A pointer to the start of the NUL-terminated demangled
  145. * name, or NULL if the demangling fails. The caller is
  146. * responsible for deallocating this memory using @c free.
  147. *
  148. * The demangling is performed using the C++ ABI mangling rules,
  149. * with GNU extensions. For example, this function is used in
  150. * __gnu_cxx::__verbose_terminate_handler.
  151. *
  152. * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/ext_demangling.html
  153. * for other examples of use.
  154. *
  155. * @note The same demangling functionality is available via
  156. * libiberty (@c <libiberty/demangle.h> and @c libiberty.a) in GCC
  157. * 3.1 and later, but that requires explicit installation (@c
  158. * --enable-install-libiberty) and uses a different API, although
  159. * the ABI is unchanged.
  160. */
  161. char*
  162. __cxa_demangle(const char* __mangled_name, char* __output_buffer,
  163. size_t* __length, int* __status);
  164. #ifdef __cplusplus
  165. }
  166. } // namespace __cxxabiv1
  167. #endif
  168. #ifdef __cplusplus
  169. #include <typeinfo>
  170. namespace __cxxabiv1
  171. {
  172. // Type information for int, float etc.
  173. class __fundamental_type_info : public std::type_info
  174. {
  175. public:
  176. explicit
  177. __fundamental_type_info(const char* __n) : std::type_info(__n) { }
  178. virtual
  179. ~__fundamental_type_info();
  180. };
  181. // Type information for array objects.
  182. class __array_type_info : public std::type_info
  183. {
  184. public:
  185. explicit
  186. __array_type_info(const char* __n) : std::type_info(__n) { }
  187. virtual
  188. ~__array_type_info();
  189. };
  190. // Type information for functions (both member and non-member).
  191. class __function_type_info : public std::type_info
  192. {
  193. public:
  194. explicit
  195. __function_type_info(const char* __n) : std::type_info(__n) { }
  196. virtual
  197. ~__function_type_info();
  198. protected:
  199. // Implementation defined member function.
  200. virtual bool
  201. __is_function_p() const;
  202. };
  203. // Type information for enumerations.
  204. class __enum_type_info : public std::type_info
  205. {
  206. public:
  207. explicit
  208. __enum_type_info(const char* __n) : std::type_info(__n) { }
  209. virtual
  210. ~__enum_type_info();
  211. };
  212. // Common type information for simple pointers and pointers to member.
  213. class __pbase_type_info : public std::type_info
  214. {
  215. public:
  216. unsigned int __flags; // Qualification of the target object.
  217. const std::type_info* __pointee; // Type of pointed to object.
  218. explicit
  219. __pbase_type_info(const char* __n, int __quals,
  220. const std::type_info* __type)
  221. : std::type_info(__n), __flags(__quals), __pointee(__type)
  222. { }
  223. virtual
  224. ~__pbase_type_info();
  225. // Implementation defined type.
  226. enum __masks
  227. {
  228. __const_mask = 0x1,
  229. __volatile_mask = 0x2,
  230. __restrict_mask = 0x4,
  231. __incomplete_mask = 0x8,
  232. __incomplete_class_mask = 0x10,
  233. __transaction_safe_mask = 0x20,
  234. __noexcept_mask = 0x40
  235. };
  236. protected:
  237. __pbase_type_info(const __pbase_type_info&);
  238. __pbase_type_info&
  239. operator=(const __pbase_type_info&);
  240. // Implementation defined member functions.
  241. virtual bool
  242. __do_catch(const std::type_info* __thr_type, void** __thr_obj,
  243. unsigned int __outer) const;
  244. inline virtual bool
  245. __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj,
  246. unsigned __outer) const;
  247. };
  248. inline bool __pbase_type_info::
  249. __pointer_catch (const __pbase_type_info *thrown_type,
  250. void **thr_obj,
  251. unsigned outer) const
  252. {
  253. return __pointee->__do_catch (thrown_type->__pointee, thr_obj, outer + 2);
  254. }
  255. // Type information for simple pointers.
  256. class __pointer_type_info : public __pbase_type_info
  257. {
  258. public:
  259. explicit
  260. __pointer_type_info(const char* __n, int __quals,
  261. const std::type_info* __type)
  262. : __pbase_type_info (__n, __quals, __type) { }
  263. virtual
  264. ~__pointer_type_info();
  265. protected:
  266. // Implementation defined member functions.
  267. virtual bool
  268. __is_pointer_p() const;
  269. virtual bool
  270. __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj,
  271. unsigned __outer) const;
  272. };
  273. class __class_type_info;
  274. // Type information for a pointer to member variable.
  275. class __pointer_to_member_type_info : public __pbase_type_info
  276. {
  277. public:
  278. __class_type_info* __context; // Class of the member.
  279. explicit
  280. __pointer_to_member_type_info(const char* __n, int __quals,
  281. const std::type_info* __type,
  282. __class_type_info* __klass)
  283. : __pbase_type_info(__n, __quals, __type), __context(__klass) { }
  284. virtual
  285. ~__pointer_to_member_type_info();
  286. protected:
  287. __pointer_to_member_type_info(const __pointer_to_member_type_info&);
  288. __pointer_to_member_type_info&
  289. operator=(const __pointer_to_member_type_info&);
  290. // Implementation defined member function.
  291. virtual bool
  292. __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj,
  293. unsigned __outer) const;
  294. };
  295. // Helper class for __vmi_class_type.
  296. class __base_class_type_info
  297. {
  298. public:
  299. const __class_type_info* __base_type; // Base class type.
  300. #ifdef _GLIBCXX_LLP64
  301. long long __offset_flags; // Offset and info.
  302. #else
  303. long __offset_flags; // Offset and info.
  304. #endif
  305. enum __offset_flags_masks
  306. {
  307. __virtual_mask = 0x1,
  308. __public_mask = 0x2,
  309. __hwm_bit = 2,
  310. __offset_shift = 8 // Bits to shift offset.
  311. };
  312. // Implementation defined member functions.
  313. bool
  314. __is_virtual_p() const
  315. { return __offset_flags & __virtual_mask; }
  316. bool
  317. __is_public_p() const
  318. { return __offset_flags & __public_mask; }
  319. ptrdiff_t
  320. __offset() const
  321. {
  322. // This shift, being of a signed type, is implementation
  323. // defined. GCC implements such shifts as arithmetic, which is
  324. // what we want.
  325. return static_cast<ptrdiff_t>(__offset_flags) >> __offset_shift;
  326. }
  327. };
  328. // Type information for a class.
  329. class __class_type_info : public std::type_info
  330. {
  331. public:
  332. explicit
  333. __class_type_info (const char *__n) : type_info(__n) { }
  334. virtual
  335. ~__class_type_info ();
  336. // Implementation defined types.
  337. // The type sub_kind tells us about how a base object is contained
  338. // within a derived object. We often do this lazily, hence the
  339. // UNKNOWN value. At other times we may use NOT_CONTAINED to mean
  340. // not publicly contained.
  341. enum __sub_kind
  342. {
  343. // We have no idea.
  344. __unknown = 0,
  345. // Not contained within us (in some circumstances this might
  346. // mean not contained publicly)
  347. __not_contained,
  348. // Contained ambiguously.
  349. __contained_ambig,
  350. // Via a virtual path.
  351. __contained_virtual_mask = __base_class_type_info::__virtual_mask,
  352. // Via a public path.
  353. __contained_public_mask = __base_class_type_info::__public_mask,
  354. // Contained within us.
  355. __contained_mask = 1 << __base_class_type_info::__hwm_bit,
  356. __contained_private = __contained_mask,
  357. __contained_public = __contained_mask | __contained_public_mask
  358. };
  359. struct __upcast_result;
  360. struct __dyncast_result;
  361. protected:
  362. // Implementation defined member functions.
  363. virtual bool
  364. __do_upcast(const __class_type_info* __dst_type, void**__obj_ptr) const;
  365. virtual bool
  366. __do_catch(const type_info* __thr_type, void** __thr_obj,
  367. unsigned __outer) const;
  368. public:
  369. // Helper for upcast. See if DST is us, or one of our bases.
  370. // Return false if not found, true if found.
  371. virtual bool
  372. __do_upcast(const __class_type_info* __dst, const void* __obj,
  373. __upcast_result& __restrict __result) const;
  374. // Indicate whether SRC_PTR of type SRC_TYPE is contained publicly
  375. // within OBJ_PTR. OBJ_PTR points to a base object of our type,
  376. // which is the destination type. SRC2DST indicates how SRC
  377. // objects might be contained within this type. If SRC_PTR is one
  378. // of our SRC_TYPE bases, indicate the virtuality. Returns
  379. // not_contained for non containment or private containment.
  380. inline __sub_kind
  381. __find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr,
  382. const __class_type_info* __src_type,
  383. const void* __src_ptr) const;
  384. // Helper for dynamic cast. ACCESS_PATH gives the access from the
  385. // most derived object to this base. DST_TYPE indicates the
  386. // desired type we want. OBJ_PTR points to a base of our type
  387. // within the complete object. SRC_TYPE indicates the static type
  388. // started from and SRC_PTR points to that base within the most
  389. // derived object. Fill in RESULT with what we find. Return true
  390. // if we have located an ambiguous match.
  391. virtual bool
  392. __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path,
  393. const __class_type_info* __dst_type, const void* __obj_ptr,
  394. const __class_type_info* __src_type, const void* __src_ptr,
  395. __dyncast_result& __result) const;
  396. // Helper for find_public_subobj. SRC2DST indicates how SRC_TYPE
  397. // bases are inherited by the type started from -- which is not
  398. // necessarily the current type. The current type will be a base
  399. // of the destination type. OBJ_PTR points to the current base.
  400. virtual __sub_kind
  401. __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr,
  402. const __class_type_info* __src_type,
  403. const void* __src_ptr) const;
  404. };
  405. // Type information for a class with a single non-virtual base.
  406. class __si_class_type_info : public __class_type_info
  407. {
  408. public:
  409. const __class_type_info* __base_type;
  410. explicit
  411. __si_class_type_info(const char *__n, const __class_type_info *__base)
  412. : __class_type_info(__n), __base_type(__base) { }
  413. virtual
  414. ~__si_class_type_info();
  415. protected:
  416. __si_class_type_info(const __si_class_type_info&);
  417. __si_class_type_info&
  418. operator=(const __si_class_type_info&);
  419. // Implementation defined member functions.
  420. virtual bool
  421. __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path,
  422. const __class_type_info* __dst_type, const void* __obj_ptr,
  423. const __class_type_info* __src_type, const void* __src_ptr,
  424. __dyncast_result& __result) const;
  425. virtual __sub_kind
  426. __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr,
  427. const __class_type_info* __src_type,
  428. const void* __sub_ptr) const;
  429. virtual bool
  430. __do_upcast(const __class_type_info*__dst, const void*__obj,
  431. __upcast_result& __restrict __result) const;
  432. };
  433. // Type information for a class with multiple and/or virtual bases.
  434. class __vmi_class_type_info : public __class_type_info
  435. {
  436. public:
  437. unsigned int __flags; // Details about the class hierarchy.
  438. unsigned int __base_count; // Number of direct bases.
  439. // The array of bases uses the trailing array struct hack so this
  440. // class is not constructable with a normal constructor. It is
  441. // internally generated by the compiler.
  442. __base_class_type_info __base_info[1]; // Array of bases.
  443. explicit
  444. __vmi_class_type_info(const char* __n, int ___flags)
  445. : __class_type_info(__n), __flags(___flags), __base_count(0) { }
  446. virtual
  447. ~__vmi_class_type_info();
  448. // Implementation defined types.
  449. enum __flags_masks
  450. {
  451. __non_diamond_repeat_mask = 0x1, // Distinct instance of repeated base.
  452. __diamond_shaped_mask = 0x2, // Diamond shaped multiple inheritance.
  453. __flags_unknown_mask = 0x10
  454. };
  455. protected:
  456. // Implementation defined member functions.
  457. virtual bool
  458. __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path,
  459. const __class_type_info* __dst_type, const void* __obj_ptr,
  460. const __class_type_info* __src_type, const void* __src_ptr,
  461. __dyncast_result& __result) const;
  462. virtual __sub_kind
  463. __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr,
  464. const __class_type_info* __src_type,
  465. const void* __src_ptr) const;
  466. virtual bool
  467. __do_upcast(const __class_type_info* __dst, const void* __obj,
  468. __upcast_result& __restrict __result) const;
  469. };
  470. // Exception handling forward declarations.
  471. struct __cxa_exception;
  472. struct __cxa_refcounted_exception;
  473. struct __cxa_dependent_exception;
  474. struct __cxa_eh_globals;
  475. extern "C"
  476. {
  477. // Dynamic cast runtime.
  478. // src2dst has the following possible values
  479. // >-1: src_type is a unique public non-virtual base of dst_type
  480. // dst_ptr + src2dst == src_ptr
  481. // -1: unspecified relationship
  482. // -2: src_type is not a public base of dst_type
  483. // -3: src_type is a multiple public non-virtual base of dst_type
  484. void*
  485. __dynamic_cast(const void* __src_ptr, // Starting object.
  486. const __class_type_info* __src_type, // Static type of object.
  487. const __class_type_info* __dst_type, // Desired target type.
  488. ptrdiff_t __src2dst); // How src and dst are related.
  489. // Exception handling runtime.
  490. // The __cxa_eh_globals for the current thread can be obtained by using
  491. // either of the following functions. The "fast" version assumes at least
  492. // one prior call of __cxa_get_globals has been made from the current
  493. // thread, so no initialization is necessary.
  494. __cxa_eh_globals*
  495. __cxa_get_globals() _GLIBCXX_NOTHROW __attribute__ ((__const__));
  496. __cxa_eh_globals*
  497. __cxa_get_globals_fast() _GLIBCXX_NOTHROW __attribute__ ((__const__));
  498. // Free the space allocated for the primary exception.
  499. void
  500. __cxa_free_exception(void*) _GLIBCXX_NOTHROW;
  501. // Throw the exception.
  502. void
  503. __cxa_throw(void*, std::type_info*, void (_GLIBCXX_CDTOR_CALLABI *) (void *))
  504. __attribute__((__noreturn__));
  505. // Used to implement exception handlers.
  506. void*
  507. __cxa_get_exception_ptr(void*) _GLIBCXX_NOTHROW __attribute__ ((__pure__));
  508. void*
  509. __cxa_begin_catch(void*) _GLIBCXX_NOTHROW;
  510. void
  511. __cxa_end_catch();
  512. void
  513. __cxa_rethrow() __attribute__((__noreturn__));
  514. // Returns the type_info for the currently handled exception [15.3/8], or
  515. // null if there is none.
  516. std::type_info*
  517. __cxa_current_exception_type() _GLIBCXX_NOTHROW __attribute__ ((__pure__));
  518. // GNU Extensions.
  519. // Allocate memory for a dependent exception.
  520. __cxa_dependent_exception*
  521. __cxa_allocate_dependent_exception() _GLIBCXX_NOTHROW;
  522. // Free the space allocated for the dependent exception.
  523. void
  524. __cxa_free_dependent_exception(__cxa_dependent_exception*) _GLIBCXX_NOTHROW;
  525. } // extern "C"
  526. // A magic placeholder class that can be caught by reference
  527. // to recognize foreign exceptions.
  528. class __foreign_exception
  529. {
  530. virtual ~__foreign_exception() throw();
  531. virtual void __pure_dummy() = 0; // prevent catch by value
  532. };
  533. } // namespace __cxxabiv1
  534. /** @namespace abi
  535. * @brief The cross-vendor C++ Application Binary Interface. A
  536. * namespace alias to __cxxabiv1, but user programs should use the
  537. * alias 'abi'.
  538. *
  539. * A brief overview of an ABI is given in the libstdc++ FAQ, question
  540. * 5.8 (you may have a copy of the FAQ locally, or you can view the online
  541. * version at http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#5_8 ).
  542. *
  543. * GCC subscribes to a cross-vendor ABI for C++, sometimes
  544. * called the IA64 ABI because it happens to be the native ABI for that
  545. * platform. It is summarized at http://www.codesourcery.com/cxx-abi/
  546. * along with the current specification.
  547. *
  548. * For users of GCC greater than or equal to 3.x, entry points are
  549. * available in <cxxabi.h>, which notes, <em>'It is not normally
  550. * necessary for user programs to include this header, or use the
  551. * entry points directly. However, this header is available should
  552. * that be needed.'</em>
  553. */
  554. namespace abi = __cxxabiv1;
  555. namespace __gnu_cxx
  556. {
  557. /**
  558. * @brief Exception thrown by __cxa_guard_acquire.
  559. * @ingroup exceptions
  560. *
  561. * C++ 2011 6.7 [stmt.dcl]/4: If control re-enters the declaration
  562. * recursively while the variable is being initialized, the behavior
  563. * is undefined.
  564. *
  565. * Since we already have a library function to handle locking, we might
  566. * as well check for this situation and throw an exception.
  567. * We use the second byte of the guard variable to remember that we're
  568. * in the middle of an initialization.
  569. */
  570. class recursive_init_error: public std::exception
  571. {
  572. public:
  573. recursive_init_error() _GLIBCXX_NOTHROW;
  574. virtual ~recursive_init_error() _GLIBCXX_NOTHROW;
  575. };
  576. }
  577. #endif // __cplusplus
  578. #pragma GCC visibility pop
  579. #endif // __CXXABI_H