source: mainline/uspace/lib/cpp/include/__bits/abi.hpp@ 4dfb259

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 4dfb259 was b57a3ee, checked in by Dzejrou <dzejrou@…>, 7 years ago

cpp: refactored the library layout, everything from the impl directory was moved to the bits directory for the sake of consistency, updated copyright notices and include guards

  • Property mode set to 100644
File size: 4.6 KB
Line 
1/*
2 * Copyright (c) 2018 Jaroslav Jindrak
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef LIBCPP_BITS_ABI
30#define LIBCPP_BITS_ABI
31
32#include <cstddef>
33#include <cstdint>
34#include <typeinfo>
35
36namespace __cxxabiv1
37{
38 /**
39 * Static constructor/destructor helpers.
40 */
41
42 extern "C" int __cxa_atexit(void (*)(void*), void*, void*);
43
44 extern "C" void __cxa_finalize(void*);
45
46 /**
47 * Itanium C++ ABI type infos.
48 * See section 2.9.4 (RTTI Layout) of the Itanium C++ ABI spec.
49 *
50 * Note: The memory representation of these classes must not
51 * be modified! (Wel, no modifications at all shall be done.)
52 *
53 * Source: https://itanium-cxx-abi.github.io/cxx-abi/abi.html
54 */
55
56 class __fundamental_type_info: public std::type_info
57 {
58 public:
59 virtual ~__fundamental_type_info();
60 };
61
62 class __array_type_info: public std::type_info
63 {
64 public:
65 virtual ~__array_type_info();
66 };
67
68 class __function_type_info: public std::type_info
69 {
70 public:
71 virtual ~__function_type_info();
72 };
73
74 class __enum_type_info: public std::type_info
75 {
76 public:
77 virtual ~__enum_type_info();
78 };
79
80 class __class_type_info: public std::type_info
81 {
82 public:
83 virtual ~__class_type_info();
84 };
85
86 class __si_class_type_info: public __class_type_info
87 {
88 public:
89 virtual ~__si_class_type_info();
90
91 const __class_type_info* __base_type;
92 };
93
94 struct __base_class_type_info
95 {
96 const __class_type_info* __base_type;
97 long __offset_flags;
98
99 enum __ofset_flags_masks
100 {
101 __virtual_mask = 0x1,
102 __public_mask = 0x2,
103 __offset_shift = 0x8
104 };
105 };
106
107 class __vmi_class_type_info: public __class_type_info
108 {
109 public:
110 virtual ~__vmi_class_type_info();
111
112 std::uint32_t __flags;
113 std::uint32_t __base_count;
114
115 __base_class_type_info __base_info[1];
116
117 enum __flags_mask
118 {
119 __non_diamond_repeat_mask = 0x1,
120 __diamond_shaped_mask = 0x2
121 };
122 };
123
124 class __pbase_type_info: public std::type_info
125 {
126 public:
127 virtual ~__pbase_type_info();
128
129 std::uint32_t __flags;
130 const std::type_info* __pointee;
131
132 enum __masks
133 {
134 __const_mask = 0x01,
135 __volatile_mask = 0x02,
136 __restrict_mask = 0x04,
137 __incomplete_mask = 0x08,
138 __incomplete_class_mask = 0x10,
139 __transaction_safe_mask = 0x20,
140 __noexcept_mask = 0x40
141 };
142 };
143
144 class __pointer_type_info: public __pbase_type_info
145 {
146 public:
147 virtual ~__pointer_type_info();
148 };
149
150 class __pointer_to_member_type_info: public __pbase_type_info
151 {
152 public:
153 virtual ~__pointer_to_member_type_info();
154
155 const __class_type_info* __context;
156 };
157
158 extern "C" void* __dynamic_cast(const void*, const __class_type_info*,
159 const __class_type_info*, std::ptrdiff_t);
160}
161
162namespace abi = __cxxabiv1;
163
164#endif
Note: See TracBrowser for help on using the repository browser.