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