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