kernel/eka/include/gcc.h
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2007-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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32\include\gcc.h
       
    15 // This is a preinclude file for GCC compilers. Currently only tested with GCC 3.4.4.
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalAll
       
    22 */
       
    23 
       
    24 // Check this header is being used as anticipated
       
    25 #ifndef __GCC32__
       
    26 #error Unexpected include of GCC header
       
    27 #endif
       
    28 #ifndef __X86__
       
    29 #error GCC header untested on non-X86 platforms
       
    30 #endif
       
    31 
       
    32 // Do product include if not done already
       
    33 #ifdef PRODUCT_INCLUDE
       
    34 #include PRODUCT_INCLUDE
       
    35 #endif
       
    36 
       
    37 // Visibility
       
    38 #define IMPORT_C
       
    39 #define IMPORT_D __attribute__((dllimport))
       
    40 #define EXPORT_C __attribute__((dllexport))
       
    41 #define EXPORT_D 
       
    42 #ifdef GCC4_OR_LATER // this would be nice... use in conjunction with -fvisibility=hidden
       
    43 #undef  EXPORT_C
       
    44 #define EXPORT_C __attribute__((visibility("default")))
       
    45 #endif
       
    46 
       
    47 // Varargs
       
    48 typedef __builtin_va_list va_list;
       
    49 #define va_start(v, l) __builtin_va_start(v, l)
       
    50 #define va_arg(v, l) __builtin_va_arg(v, l)
       
    51 #define va_end(v) __builtin_va_end(v)
       
    52 #define VA_LIST va_list
       
    53 #define _VA_LIST_DEFINED //To deal with stdarg.h
       
    54 #define __VA_LIST_defined //To deal with e32def.h
       
    55 #define VA_START(ap,pn) va_start(ap, pn)
       
    56 #define VA_ARG(ap,type) va_arg(ap,type)
       
    57 #define VA_END(ap)      va_end(ap)
       
    58 
       
    59 // Stdlib/OpenEnv support
       
    60 // This should prevent /stdlib/linc/stdarg.h from doing damage.
       
    61 #define _STDARG_H
       
    62 // now deal with stdarg_e.h
       
    63 typedef va_list __e32_va_list;
       
    64 #define _STDARG_E_H
       
    65 // wchar_t is a primtive type for C++ on GCC
       
    66 #ifdef __cplusplus
       
    67 #define __wchar_t_defined
       
    68 #endif
       
    69 
       
    70 // General
       
    71 #define __NO_CLASS_CONSTS__
       
    72 #define	I64LIT(x)	x##LL
       
    73 #define	UI64LIT(x)	x##ULL
       
    74 #define __SOFTFP
       
    75 #define __NORETURN__  __attribute__ ((noreturn))
       
    76 #define NONSHARABLE_CLASS(x) class /*__attribute__(notshared)*/ x
       
    77 #define NONSHARABLE_STRUCT(x) struct /*__attribute__(notshared)*/ x
       
    78 #define __NO_THROW //throw ()
       
    79 #define __THROW(t) //throw (t)
       
    80 #define TEMPLATE_SPECIALIZATION template<>
       
    81 
       
    82 #ifndef __cdecl
       
    83 #define __cdecl __attribute__((cdecl))
       
    84 #endif
       
    85 #ifndef __fastcall
       
    86 #define __fastcall __attribute__((fastcall))
       
    87 #endif
       
    88 #ifndef __stdcall
       
    89 #define __stdcall __attribute__((stdcall))
       
    90 #endif
       
    91 
       
    92 // These are built-in defines during compilation stage but are also required (and not defined) during makmake stage
       
    93 #ifndef __GNUC__
       
    94 #define __GNUC__ 3
       
    95 #endif
       
    96 
       
    97 #ifndef __i386
       
    98 #define __i386
       
    99 #endif
       
   100