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