Support using GetTextExtent() with empty string to get descent in wxOSX.
[wxWidgets.git] / include / wx / compiler.h
0 / 145 (  0%)
CommitLineData
1/*
2 * Name: 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
8 */
9
10/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
11
12#ifndef _WX_COMPILER_H_
13#define _WX_COMPILER_H_
14
15/*
16 Compiler detection and related helpers.
17 */
18
19#ifdef __INTEL_COMPILER
20# define __INTELC__
21#elif defined(_MSC_VER)
22 /*
23 define another standard symbol for Microsoft Visual C++: the standard
24 one (_MSC_VER) is also defined by some other compilers.
25 */
26# define __VISUALC__ _MSC_VER
27
28 /*
29 define special symbols for different VC version instead of writing tests
30 for magic numbers such as 1200, 1300 &c repeatedly
31 */
32#if __VISUALC__ < 1100
33# error "This Visual C++ version is too old and not supported any longer."
34#elif __VISUALC__ < 1200
35# define __VISUALC5__
36#elif __VISUALC__ < 1300
37# define __VISUALC6__
38#elif __VISUALC__ < 1400
39# define __VISUALC7__
40#elif __VISUALC__ < 1500
41# define __VISUALC8__
42#elif __VISUALC__ < 1600
43# define __VISUALC9__
44#elif __VISUALC__ < 1700
45# define __VISUALC10__
46#elif __VISUALC__ < 1800
47# define __VISUALC11__
48#elif __VISUALC__ < 1900
49# define __VISUALC12__
50#else
51# pragma message("Please update wx/compiler.h to recognize this VC++ version")
52#endif
53
54#elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__)
55# define __BORLANDC__
56#elif defined(__WATCOMC__)
57#elif defined(__SC__)
58# define __SYMANTECC__
59#elif defined(__SUNPRO_CC)
60# ifndef __SUNCC__
61# define __SUNCC__ __SUNPRO_CC
62# endif /* Sun CC */
63#elif defined(__SC__)
64# ifdef __DMC__
65# define __DIGITALMARS__
66# else
67# define __SYMANTEC__
68# endif
69#endif /* compiler */
70
71/*
72 Macros for checking compiler version.
73*/
74
75/*
76 This macro can be used to test the gcc version and can be used like this:
77
78# if wxCHECK_GCC_VERSION(3, 1)
79 ... we have gcc 3.1 or later ...
80# else
81 ... no gcc at all or gcc < 3.1 ...
82# endif
83*/
84#if defined(__GNUC__) && defined(__GNUC_MINOR__)
85 #define wxCHECK_GCC_VERSION( major, minor ) \
86 ( ( __GNUC__ > (major) ) \
87 || ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) )
88#else
89 #define wxCHECK_GCC_VERSION( major, minor ) 0
90#endif
91
92/*
93 This macro can be used to test the Visual C++ version.
94*/
95#ifndef __VISUALC__
96# define wxVISUALC_VERSION(major) 0
97# define wxCHECK_VISUALC_VERSION(major) 0
98#else
99# define wxVISUALC_VERSION(major) ( (6 + major) * 100 )
100# define wxCHECK_VISUALC_VERSION(major) ( __VISUALC__ >= wxVISUALC_VERSION(major) )
101#endif
102
103/**
104 This is similar to wxCHECK_GCC_VERSION but for Sun CC compiler.
105 */
106#ifdef __SUNCC__
107 /*
108 __SUNCC__ is 0xVRP where V is major version, R release and P patch level
109 */
110 #define wxCHECK_SUNCC_VERSION(maj, min) (__SUNCC__ >= (((maj)<<8) | ((min)<<4)))
111#else
112 #define wxCHECK_SUNCC_VERSION(maj, min) (0)
113#endif
114
115#ifndef __WATCOMC__
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 )
120#else
121# if __WATCOMC__ < 1200
122# error "Only Open Watcom is supported in this release"
123# endif
124
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
129#endif
130
131/*
132 This macro can be used to check that the version of mingw32 compiler is
133 at least maj.min
134 */
135
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) ) ) )
141#else
142 #define wxCHECK_MINGW32_VERSION( major, minor ) (0)
143#endif
144
145#endif // _WX_COMPILER_H_