1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     compiler.h
4 
5   Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Revision: 25242 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NW_CONFIG_COMPILER_H_
17 #define NW_CONFIG_COMPILER_H_
18 
19 #if defined( __CC_ARM ) || defined( __ARMCC_VERSION )
20   // ARM RealView Compiler.
21   #define NW_COMPILER_RVCT
22   #include <nw/config/compiler/rvct.h>
23 
24   #define NW_DEPRECATED_FUNCTION_MSG(MFunc, msg) MFunc __attribute__ ((deprecated))
25   #define NW_CHECKED_ARRAY_ITERATOR(MIte, MNum) MIte
26   #define NW_CHAR_TRAITS_COPY(MType, MDest, MDestSize, MFrom, MCount) std::char_traits<MType>::copy(MDest, MFrom, MCount)
27 
28 #elif defined( __CWCC__ ) || defined( __MWERKS__ )
29   // Freescale CodeWarrior
30   #define NW_COMPILER_CWCC
31   #define NW_COMPILER_MWERKS // 互換性のため(非推奨)
32   #include <nw/config/compiler/cwcc.h>
33 
34   #define NW_DEPRECATED_FUNCTION_MSG(MFunc, msg) MFunc
35   #define NW_CHECKED_ARRAY_ITERATOR(MIte, MNum) MIte
36   #define NW_CHAR_TRAITS_COPY(MType, MDest, MDestSize, MFrom, MCount) std::char_traits<MType>::copy(MDest, MFrom, MCount)
37 
38 #elif defined( __GNUC__ )
39   // GNU C++
40   #define NW_COMPILER_GCC
41   #include <nw/config/compiler/gcc.h>
42 
43   #define NW_DEPRECATED_FUNCTION_MSG(MFunc, msg) MFunc __attribute__ ((deprecated))
44   #define NW_CHECKED_ARRAY_ITERATOR(MIte, MNum) MIte
45   #define NW_CHAR_TRAITS_COPY(MType, MDest, MDestSize, MFrom, MCount) std::char_traits<MType>::copy(MDest, MFrom, MCount)
46 
47 #elif defined( _MSC_VER )
48   // Miscrosoft Visual C++
49   #define NW_COMPILER_MSVC
50   #include <nw/config/compiler/msvc.h>
51 
52   #define NW_DEPRECATED_FUNCTION_MSG(MFunc, msg) __declspec(deprecated(msg)) MFunc
53   #define NW_CHECKED_ARRAY_ITERATOR(MIte, MNum) stdext::make_checked_array_iterator(MIte, MNum)
54   #define NW_CHAR_TRAITS_COPY(MType, MDest, MDestSize, MFrom, MCount) std::char_traits<MType>::_Copy_s(MDest, MDestSize, MFrom, MCount)
55 
56 #else
57 
58   #error "Unknown compiler"
59 
60 #endif
61 
62 #if !defined(NW_DEPRECATED_FUNCTION)
63   #if defined(NW_IGNORE_DEPRECATED)
64     #define NW_DEPRECATED_FUNCTION(MFunc) MFunc
65   #else
66     #define NW_DEPRECATED_FUNCTION(MFunc) NW_DEPRECATED_FUNCTION_MSG(MFunc, "## Deprecated function ##")
67   #endif
68 #endif
69 
70 #ifndef NW_NO_THROW
71   #define NW_NO_THROW
72 #endif
73 
74 
75 /* NW_CONFIG_COMPILER_H_ */
76 #endif
77