|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "ARM EABI LICENCE.txt" |
|
5 // which accompanies this distribution, and is available |
|
6 // in kernel/eka/compsupp. |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This is the preinclude file for the RVCT compiler. It contains all the compiler |
|
15 // specific definitions required by the Symbian OS source code. |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @publishedAll |
|
22 @released |
|
23 */ |
|
24 |
|
25 #if defined(__PRODUCT_INCLUDE__) |
|
26 #include __PRODUCT_INCLUDE__ |
|
27 #endif |
|
28 |
|
29 // stuff from e32def.h |
|
30 #define __NO_CLASS_CONSTS__ |
|
31 #define __NORETURN__ __declspec(noreturn) |
|
32 #define __NORETURN_TERMINATOR() |
|
33 |
|
34 #ifndef IMPORT_C |
|
35 #define IMPORT_C __declspec(dllimport) |
|
36 #endif |
|
37 |
|
38 #ifndef EXPORT_C |
|
39 #define EXPORT_C __declspec(dllexport) |
|
40 #endif |
|
41 |
|
42 #ifndef IMPORT_D |
|
43 #if __ARMCC_VERSION < 310000 |
|
44 #define IMPORT_D __declspec(dllexport) |
|
45 #else |
|
46 #define IMPORT_D __declspec(dllimport) |
|
47 #endif |
|
48 #endif |
|
49 |
|
50 #ifndef EXPORT_D |
|
51 #define EXPORT_D __declspec(dllexport) |
|
52 #endif |
|
53 |
|
54 // Used by some of RVCT's header files. For more information, see "C Library ABI for |
|
55 // the ARM Architecture." |
|
56 #define _AEABI_PORTABILITY_LEVEL 0 |
|
57 |
|
58 /** |
|
59 Declares a class as being non-sharable. |
|
60 |
|
61 If a class is non-sharable, then a class implemented in another DLL cannot |
|
62 derive (inherit) from that class. |
|
63 |
|
64 Declaring a class as non-sharable prevents the compiler from exporting compiler |
|
65 implementation-specific symbols, i.e. run-time type-information and virtual |
|
66 tables. This prevents classes in other DLLs from being able to derive from it. |
|
67 |
|
68 Note : |
|
69 - if a class is marked as non-sharable, then Symbian OS requires all |
|
70 classes that are derived from that class, and which are also implemented in the same DLL, |
|
71 to be declared as non-sharable. |
|
72 - by default, a class is sharable. |
|
73 |
|
74 The following code fragment shows how a non-sharable class is declared. |
|
75 |
|
76 @code |
|
77 NONSHARABLE_CLASS(CMyClass) : public CBase |
|
78 { |
|
79 public : |
|
80 ... |
|
81 private : |
|
82 ... |
|
83 } |
|
84 @endcode |
|
85 |
|
86 @param x The name of the class to be declared as non-sharable. |
|
87 */ |
|
88 #define NONSHARABLE_CLASS(x) class __declspec(notshared) x |
|
89 #define NONSHARABLE_STRUCT(x) struct __declspec(notshared) x |
|
90 |
|
91 #define __NO_THROW throw () |
|
92 #define __THROW(t) throw (t) |
|
93 |
|
94 #define TEMPLATE_SPECIALIZATION template<> |
|
95 |
|
96 #ifndef __int64 |
|
97 #define __int64 long long |
|
98 #endif |
|
99 |
|
100 #define __VALUE_IN_REGS__ __value_in_regs |
|
101 |
|
102 #define I64LIT(x) x##LL |
|
103 #define UI64LIT(x) x##ULL |
|
104 |
|
105 #define __SOFTFP __softfp |
|
106 |
|
107 // __TText from e32cmn.h also e32des16.h |
|
108 #ifdef __cplusplus |
|
109 typedef wchar_t __TText; // Only ISO C++ has wchar_t as a primitive type |
|
110 #define __wchar_t_defined |
|
111 #else |
|
112 typedef unsigned short __TText; |
|
113 #endif |
|
114 #define __TText_defined |
|
115 |
|
116 // __NAKED__ from cpudefs.h |
|
117 #define __NAKED__ __asm |
|
118 #define ____ONLY_USE_NAKED_IN_CIA____ __asm |
|
119 #define __WEAK__ __attribute__((weak)) |
|
120 |
|
121 // Int64 and Uint64 from nkern\nklib.h |
|
122 typedef long long Int64; |
|
123 typedef unsigned long long Uint64; |
|
124 |
|
125 // Here are RVCT's definitions for stdarg.h |
|
126 // These should be used by e.g. stdlib |
|
127 |
|
128 #ifdef __cplusplus |
|
129 namespace std { extern "C" { |
|
130 #endif |
|
131 |
|
132 typedef struct __va_list { void *__ap; } va_list; |
|
133 |
|
134 #ifdef __cplusplus |
|
135 } } |
|
136 using ::std::va_list; |
|
137 #endif |
|
138 |
|
139 #define va_start(ap, parmN) __va_start(ap, parmN) |
|
140 #define va_arg(ap, type) __va_arg(ap, type) |
|
141 #define va_end(ap) ((void)0) |
|
142 |
|
143 // These are for Symbian OS C++ code |
|
144 #define VA_START(ap,pn) va_start(ap, pn) |
|
145 #define VA_ARG(ap,type) va_arg(ap,type) |
|
146 #define VA_END(ap) va_end(ap) |
|
147 #define VA_LIST va_list |
|
148 #define __VA_LIST_defined |
|
149 // This should prevent /stdlib/linc/stdarg.h from doing damage. |
|
150 #define _STDARG_H |
|
151 |
|
152 // now deal with stdarg_e.h |
|
153 typedef va_list __e32_va_list; |
|
154 #define _STDARG_E_H |
|
155 |
|
156 // This is an EABI compliant compiler |
|
157 #ifndef __EABI__ |
|
158 #define __EABI__ |
|
159 #endif |
|
160 |
|
161 // These are hopefully temporary. |
|
162 |
|
163 // defining this means we don't get __NAKED__ ctors |
|
164 #ifndef __EABI_CTORS__ |
|
165 #define __EABI_CTORS__ |
|
166 #endif |
|
167 |
|
168 #ifndef __SYMBIAN_STDCPP_SUPPORT__ |
|
169 #include <symcpp.h> |
|
170 #endif |
|
171 |
|
172 #ifdef __cplusplus |
|
173 // Support for throwing exceptions through embedded assembler Should only be |
|
174 // needed user side. |
|
175 |
|
176 #define __EH_FRAME_ADDRESS(reg,offset) FRAME ADDRESS reg, offset |
|
177 #define __EH_FRAME_PUSH2(reg1,reg2) FRAME PUSH {reg1, reg2} |
|
178 #define __EH_FRAME_SAVE1(reg,offset) FRAME SAVE {reg}, offset |
|
179 #endif |
|
180 |