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