]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/compiler.h
3 * Purpose: Compiler-specific macro definitions.
4 * Author: Vadim Zeitlin
5 * Created: 2013-07-13 (extracted from wx/platform.h)
6 * Copyright: (c) 1997-2013 Vadim Zeitlin <vadim@wxwidgets.org>
7 * Licence: wxWindows licence
10 /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
12 #ifndef _WX_COMPILER_H_
13 #define _WX_COMPILER_H_
16 Compiler detection and related helpers.
19 #ifdef __INTEL_COMPILER
21 #elif defined(_MSC_VER)
23 define another standard symbol for Microsoft Visual C++: the standard
24 one (_MSC_VER) is also defined by some other compilers.
26 # define __VISUALC__ _MSC_VER
29 define special symbols for different VC version instead of writing tests
30 for magic numbers such as 1200, 1300 &c repeatedly
32 #if __VISUALC__ < 1100
33 # error "This Visual C++ version is too old and not supported any longer."
34 #elif __VISUALC__ < 1200
36 #elif __VISUALC__ < 1300
38 #elif __VISUALC__ < 1400
40 #elif __VISUALC__ < 1500
42 #elif __VISUALC__ < 1600
44 #elif __VISUALC__ < 1700
45 # define __VISUALC10__
46 #elif __VISUALC__ < 1800
47 # define __VISUALC11__
48 #elif __VISUALC__ < 1900
49 # define __VISUALC12__
51 # pragma message("Please update wx/compiler.h to recognize this VC++ version")
54 #elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__)
56 #elif defined(__WATCOMC__)
58 # define __SYMANTECC__
59 #elif defined(__SUNPRO_CC)
61 # define __SUNCC__ __SUNPRO_CC
65 # define __DIGITALMARS__
72 Macros for checking compiler version.
76 This macro can be used to test the gcc version and can be used like this:
78 # if wxCHECK_GCC_VERSION(3, 1)
79 ... we have gcc 3.1 or later ...
81 ... no gcc at all or gcc < 3.1 ...
84 #if defined(__GNUC__) && defined(__GNUC_MINOR__)
85 #define wxCHECK_GCC_VERSION( major, minor ) \
86 ( ( __GNUC__ > (major) ) \
87 || ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) )
89 #define wxCHECK_GCC_VERSION( major, minor ) 0
93 This macro can be used to test the Visual C++ version.
96 # define wxVISUALC_VERSION(major) 0
97 # define wxCHECK_VISUALC_VERSION(major) 0
99 # define wxVISUALC_VERSION(major) ( (6 + major) * 100 )
100 # define wxCHECK_VISUALC_VERSION(major) ( __VISUALC__ >= wxVISUALC_VERSION(major) )
104 This is similar to wxCHECK_GCC_VERSION but for Sun CC compiler.
108 __SUNCC__ is 0xVRP where V is major version, R release and P patch level
110 #define wxCHECK_SUNCC_VERSION(maj, min) (__SUNCC__ >= (((maj)<<8) | ((min)<<4)))
112 #define wxCHECK_SUNCC_VERSION(maj, min) (0)
116 # define wxWATCOM_VERSION(major,minor) 0
117 # define wxCHECK_WATCOM_VERSION(major,minor) 0
118 # define wxONLY_WATCOM_EARLIER_THAN(major,minor) 0
119 # define WX_WATCOM_ONLY_CODE( x )
121 # if __WATCOMC__ < 1200
122 # error "Only Open Watcom is supported in this release"
125 # define wxWATCOM_VERSION(major,minor) ( major * 100 + minor * 10 + 1100 )
126 # define wxCHECK_WATCOM_VERSION(major,minor) ( __WATCOMC__ >= wxWATCOM_VERSION(major,minor) )
127 # define wxONLY_WATCOM_EARLIER_THAN(major,minor) ( __WATCOMC__ < wxWATCOM_VERSION(major,minor) )
128 # define WX_WATCOM_ONLY_CODE( x ) x
132 This macro can be used to check that the version of mingw32 compiler is
136 /* Check for Mingw runtime version: */
137 #if defined(__MINGW32_MAJOR_VERSION) && defined(__MINGW32_MINOR_VERSION)
138 #define wxCHECK_MINGW32_VERSION( major, minor ) \
139 ( ( ( __MINGW32_MAJOR_VERSION > (major) ) \
140 || ( __MINGW32_MAJOR_VERSION == (major) && __MINGW32_MINOR_VERSION >= (minor) ) ) )
142 #define wxCHECK_MINGW32_VERSION( major, minor ) (0)
145 #endif // _WX_COMPILER_H_