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