epoc32/include/gcce/gcce.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     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 "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     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 
    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 #define __NO_CLASS_CONSTS__
    34 #define __NORETURN__ __declspec(noreturn)
    35 #define __NORETURN_TERMINATOR()
    36 #define IMPORT_C __declspec(dllimport) 
    37 #define EXPORT_C __declspec(dllexport)
    38 
    39 
    40 
    41 
    42 /**
    43 Declares a class as being non-sharable.
    44 
    45 If a class is non-sharable, then a class implemented in another DLL cannot
    46 derive (inherit) from that class.
    47 
    48 Declaring a class as non-sharable prevents the compiler from exporting compiler
    49 implementation-specific symbols, i.e. run-time type-information and virtual
    50 tables. This prevents classes in other DLLs from being able to derive from it.
    51 
    52 Note :
    53 - if a class is marked as non-sharable, then Symbian OS requires all
    54 classes that are derived from that class, and which are also implemented in the same DLL, 
    55 to be declared as non-sharable.
    56 - by default, a class is sharable.
    57 
    58 The following code fragment shows how a non-sharable class is declared.
    59 @code
    60 NONSHARABLE_CLASS(CMyClass) : public CBase
    61 	{
    62 	public :
    63 	...
    64 	private :
    65 	...
    66 	}
    67 @endcode
    68 
    69 @param x  The name of the class to be declared as non-sharable.
    70 */
    71 #define NONSHARABLE_CLASS(x) class __declspec(notshared) x
    72 
    73 #define NONSHARABLE_STRUCT(x) struct __declspec(notshared) x
    74 #define __NO_THROW throw ()
    75 #define __THROW(t) throw (t)
    76 #define TEMPLATE_SPECIALIZATION template<>
    77 #ifndef __int64
    78 #define __int64  long long
    79 #endif
    80 #define __VALUE_IN_REGS__
    81 #define	I64LIT(x)	x##LL
    82 #define	UI64LIT(x)	x##ULL
    83 #define __SOFTFP
    84 
    85 // __TText from e32cmn.h also e32des16.h
    86 #ifdef __cplusplus
    87 typedef wchar_t __TText;	// Only ISO C++ has wchar_t as a primitive type
    88 #define __wchar_t_defined
    89 #else
    90 typedef unsigned short __TText;	
    91 #endif
    92 #define __TText_defined
    93 
    94 // __NAKED__ from cpudefs.h
    95 #define __NAKED__ __asm
    96 #define ____ONLY_USE_NAKED_IN_CIA____ __asm
    97 
    98 // Int64 and Uint64 from nkern\nklib.h
    99 typedef long long Int64;
   100 typedef unsigned long long Uint64;
   101 
   102 // Here are GCC-E's definitions for stdarg.h
   103 // These should be used by e.g. stdlib
   104 
   105 #ifdef __cplusplus
   106     namespace std {
   107         extern "C" {
   108 #endif  /* __cplusplus */
   109 
   110 typedef struct __va_list { void *__ap; } va_list;
   111 
   112 
   113 #ifdef __cplusplus
   114 	}  /* extern "C" */
   115     }  /* namespace std */
   116 
   117     using ::std::va_list;
   118 #endif
   119 
   120 #define va_start(ap, parmN) __builtin_va_start(ap.__ap, parmN)
   121 #define va_arg(ap, type) __builtin_va_arg(ap.__ap, type)
   122 #define va_end(ap) __builtin_va_end(ap.__ap)
   123 
   124 
   125 #define VA_LIST va_list
   126 #define _VA_LIST_DEFINED //To deal with stdarg.h
   127 #define __VA_LIST_defined //To deal with e32def.h
   128 
   129 // These are for Symbian OS C++ code
   130 #define VA_START(ap,pn) va_start(ap, pn)
   131 #define VA_ARG(ap,type) va_arg(ap,type)
   132 #define VA_END(ap)      va_end(ap)
   133 // This should prevent /stdlib/linc/stdarg.h from doing damage.
   134 #define _STDARG_H
   135 
   136 // now deal with stdarg_e.h
   137 typedef va_list __e32_va_list;
   138 #define _STDARG_E_H
   139 
   140 // This is an EABI compliant compiler
   141 #ifndef __EABI__
   142 #define __EABI__
   143 #endif
   144 
   145 // these are hopefully temporary
   146 
   147 // defining this means we don't get __NAKED__ ctors
   148 #ifndef __EABI_CTORS__
   149 #define __EABI_CTORS__
   150 #endif
   151 
   152 //#define __EARLY_DEBUG__
   153 
   154 // Deal with operator new issues here
   155 #include "../symcpp.h"
   156 
   157 #ifdef __cplusplus
   158 // Support for throwing exceptions through embedded assembler
   159 // Should only be needed user side
   160 
   161 #define	__EH_FRAME_ADDRESS(reg,offset)	FRAME ADDRESS reg, offset
   162 #define __EH_FRAME_PUSH2(reg1,reg2) FRAME PUSH {reg1, reg2}
   163 #define __EH_FRAME_SAVE1(reg,offset) FRAME SAVE {reg}, offset
   164 
   165 #endif