kernel/eka/compsupp/rvct.h
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     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 
       
   120 // Int64 and Uint64 from nkern\nklib.h
       
   121 typedef long long Int64;
       
   122 typedef unsigned long long Uint64;
       
   123 
       
   124 // Here are RVCT's definitions for stdarg.h
       
   125 // These should be used by e.g. stdlib
       
   126 
       
   127 #ifdef __cplusplus
       
   128 namespace std { extern "C" {
       
   129 #endif
       
   130 
       
   131     typedef struct __va_list { void *__ap; } va_list;
       
   132 
       
   133 #ifdef __cplusplus
       
   134 } } 
       
   135 using ::std::va_list;
       
   136 #endif
       
   137 
       
   138 #define va_start(ap, parmN) __va_start(ap, parmN)
       
   139 #define va_arg(ap, type)    __va_arg(ap, type)
       
   140 #define va_end(ap)          ((void)0)
       
   141 
       
   142 // These are for Symbian OS C++ code
       
   143 #define VA_START(ap,pn) va_start(ap, pn)
       
   144 #define VA_ARG(ap,type) va_arg(ap,type)
       
   145 #define VA_END(ap)      va_end(ap)
       
   146 #define VA_LIST va_list
       
   147 #define __VA_LIST_defined
       
   148 // This should prevent /stdlib/linc/stdarg.h from doing damage.
       
   149 #define _STDARG_H
       
   150 
       
   151 // now deal with stdarg_e.h
       
   152 typedef va_list __e32_va_list;
       
   153 #define _STDARG_E_H
       
   154 
       
   155 // This is an EABI compliant compiler
       
   156 #ifndef __EABI__
       
   157 #define __EABI__
       
   158 #endif
       
   159 
       
   160 // These are hopefully temporary.
       
   161 
       
   162 // defining this means we don't get __NAKED__ ctors
       
   163 #ifndef __EABI_CTORS__
       
   164 #define __EABI_CTORS__
       
   165 #endif
       
   166 
       
   167 #ifndef __SYMBIAN_STDCPP_SUPPORT__
       
   168 	#include <symcpp.h>
       
   169 #endif
       
   170 
       
   171 #ifdef __cplusplus
       
   172     // Support for throwing exceptions through embedded assembler Should only be
       
   173     // needed user side.
       
   174     
       
   175     #define	__EH_FRAME_ADDRESS(reg,offset)  FRAME ADDRESS reg, offset
       
   176     #define __EH_FRAME_PUSH2(reg1,reg2)     FRAME PUSH {reg1, reg2}
       
   177     #define __EH_FRAME_SAVE1(reg,offset)    FRAME SAVE {reg}, offset
       
   178 #endif
       
   179