cxxabi.h 22 KB

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