epoc32/include/gcce/gcce.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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 #define __WEAK__  __attribute__((weak))
   101 
   102 // Int64 and Uint64 from nkern\nklib.h
   103 typedef long long Int64;
   104 typedef unsigned long long Uint64;
   105 
   106 // Here are GCC-E's definitions for stdarg.h
   107 // These should be used by e.g. stdlib
   108 
   109 #ifdef __cplusplus
   110     namespace std { extern "C" {
   111 #endif
   112 
   113     #if __GNUC__ < 4
   114     typedef struct __va_list { void *__ap; } va_list;
   115     #else
   116     typedef __builtin_va_list va_list;
   117     #endif
   118 
   119 #ifdef __cplusplus
   120 	} }
   121     using ::std::va_list;
   122 #endif
   123 
   124 #if __GNUC__ < 4
   125 #define va_start(ap, parmN) __builtin_va_start(ap.__ap, parmN)
   126 #define va_arg(ap, type)    __builtin_va_arg(ap.__ap, type)
   127 #define va_end(ap)          __builtin_va_end(ap.__ap)
   128 #else
   129 #define va_start(ap, parmN) __builtin_va_start(ap, parmN)
   130 #define va_arg(ap, type)    __builtin_va_arg(ap, type)
   131 #define va_end(ap)          __builtin_va_end(ap)
   132 #endif
   133 
   134 #define VA_LIST va_list
   135 #define _VA_LIST_DEFINED //To deal with stdarg.h
   136 #define __VA_LIST_defined //To deal with e32def.h
   137 
   138 // These are for Symbian OS C++ code
   139 #define VA_START(ap,pn) va_start(ap, pn)
   140 #define VA_ARG(ap,type) va_arg(ap,type)
   141 #define VA_END(ap)      va_end(ap)
   142 // This should prevent /stdlib/linc/stdarg.h from doing damage.
   143 #define _STDARG_H
   144 
   145 // now deal with stdarg_e.h
   146 typedef va_list __e32_va_list;
   147 #define _STDARG_E_H
   148 
   149 // This is an EABI compliant compiler
   150 #ifndef __EABI__
   151 #define __EABI__
   152 #endif
   153 
   154 // these are hopefully temporary
   155 
   156 // defining this means we don't get __NAKED__ ctors
   157 #ifndef __EABI_CTORS__
   158 #define __EABI_CTORS__
   159 #endif
   160 
   161 //#define __EARLY_DEBUG__
   162 
   163 #ifndef __SYMBIAN_STDCPP_SUPPORT__
   164 	#include <symcpp.h>
   165 #endif
   166 
   167 #ifdef __cplusplus
   168 // Support for throwing exceptions through embedded assembler
   169 // Should only be needed user side
   170 
   171 #define	__EH_FRAME_ADDRESS(reg,offset)	FRAME ADDRESS reg, offset
   172 #define __EH_FRAME_PUSH2(reg1,reg2) FRAME PUSH {reg1, reg2}
   173 #define __EH_FRAME_SAVE1(reg,offset) FRAME SAVE {reg}, offset
   174 
   175 #endif
   176