Alchemy
1.0
A framework to robustly process network messages and structured data
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
Pb
compiler.h
1
/// @file meta/compiler.h
2
/// This file contains any macros that can be used to improve the clarity of
3
/// code or ease for debugging purposes.
4
///
5
/// The MIT License(MIT)
6
/// @copyright 2014 Paul M Watt
7
// ****************************************************************************
8
#ifndef COMPILER_H_INCLUDED
9
#define COMPILER_H_INCLUDED
10
// Includes *******************************************************************
11
#include <
Pb/detail/endianess.h
>
12
#include <
Pb/detail/tr1_helper.h
>
13
#include <
Pb/detail/auto.h
>
14
#include <
Pb/detail/decltype.h
>
15
#include <
Pb/detail/static_assert.h
>
16
#include <
Pb/detail/explicit_conversion.h
>
17
#include <
Pb/detail/alias_templates.h
>
18
#include <
Pb/detail/variadic_templates.h
>
19
#include <
Pb/detail/range_for.h
>
20
#include <
Pb/detail/rvalue_ref.h
>
21
#include <
Pb/detail/trailing_fn_return.h
>
22
23
24
// ****************************************************************************
25
// Reference for compiler flags and versions.
26
//
27
// MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013)
28
// MSVC++ 11.0 _MSC_VER == 1700 (Visual Studio 2012)
29
// MSVC++ 10.0 _MSC_VER == 1600 (Visual Studio 2010)
30
// MSVC++ 9.0 _MSC_VER == 1500 (Visual Studio 2008)
31
//
32
33
34
// CxxUnit Testing *************************************************************
35
// Change the mock namespace from T to cxx to reduce confusion with template semantics.
36
#define CXXTEST_MOCK_NAMESPACE cxx
37
38
// PRAGMA Define for use in MACROS *********************************************
39
#ifdef _MSC_VER
40
# define DO_PRAGMA(x) __pragma(x)
41
#elif defined(__GCC__)
42
# define DO_PRAGMA(x) _Pragma(x)
43
#else
44
# define DO_PRAGMA(x)
45
#endif
46
47
// Stringize Helper ************************************************************
48
#define STR2_(x) #x
49
#define STR1_(x) STR2_(x)
50
51
#define WSTR2_(x) L ## x
52
#define WSTR1_(x) _T(x)
53
54
// Notice And TODO Macro *******************************************************
55
// The notice macro set will display a message in the compiler
56
// output window that you may click to take you immediately to
57
// the line in the file where the message is located.
58
//
59
// These messages will only be printed for DEBUG builds.
60
//
61
62
#ifdef _DEBUG
63
// This message will be printed to the debug window.
64
// NOTICE: This is a notice!
65
#define NOTICE(str) DO_PRAGMA(message(__FILE__ "(" STR1_(__LINE__) "): NOTICE: " str))
66
67
// This message will be printed to the debug window.
68
// TODO: This is a notice!
69
#define TODO(str) DO_PRAGMA(message(__FILE__ "(" STR1_(__LINE__) "): TODO: " str))
70
71
#else
72
#define NOTICE(str)
73
#define TODO(str)
74
#endif
75
76
// Compiler Dependant Type Definitions *****************************************
77
78
#endif //__COMPILER_H
79
80
// Macros for conditional compilation on different platforms *******************
81
#ifdef UNDER_CE
82
// Removes severe warnings on CE
83
# ifndef _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA
84
# define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA
85
# endif
86
87
// Set a windows version to remove certain warnings.
88
# ifndef WINVER
89
# define WINVER 0x0400
90
# endif
91
92
# undef _WIN32_WINDOWS
93
# undef _WIN32_WINNT
94
95
# ifdef WIN32_PLATFORM_PSPC
96
# ifndef SHELL_AYGSHELL
97
# define SHELL_AYGSHELL
98
# endif
99
# endif
100
101
#elif defined(_WIN32)
102
// Set windows XP as the default version if one is not yet defined.
103
# ifndef WINVER
104
# define WINVER 0x0501
105
# endif
106
107
# ifndef UNDER_NT
108
# define UNDER_NT
109
# endif
110
111
#elif defined(linux)
112
# ifndef UNDER_LINUX
113
# define UNDER_LINUX
114
# endif
115
116
#elif defined(apple_ios)
117
# ifndef UNDER_APPLE_IOS
118
# define UNDER_APPLE_IOS
119
# endif
120
121
#elif defined(SOLARIS)
122
# ifndef UNDER_SOLARIS
123
# define UNDER_SOLARIS
124
# endif
125
126
#else
127
# error Must add definition to indicate platform.
128
#endif
129
130
131
#if defined(__cplusplus)
132
133
// STL Definitions *************************************************************
134
#ifdef _WIN32
135
# define BOOST_NO_STD_TYPEINFO
136
#endif
137
138
// Add definitions to disable exception handling in the STL
139
// implementations on CE.
140
#ifdef UNDER_CE
141
#define BOOST_NO_EXCEPTION_STD_NAMESPACE
142
#if _WIN32_WCE < 0x500 && _MSC_VER > 1220
143
// only needed for WM2003 builds under VS2005
144
#pragma comment(lib, "ccrtrtti.lib")
145
#else
146
147
#ifdef _HAS_EXCEPTIONS
148
#undef _HAS_EXCEPTIONS
149
#endif
/* _HAS_EXCEPTIONS */
150
151
#define _HAS_EXCEPTIONS 0
152
// These extra inclusions and redefinitions need to occur
153
// for eVC4.0 and CE.Net4.2.
154
#if (_WIN32_WCE <= 0x420)
155
156
// These macros are defined in here:
157
//#define _TRY_BEGIN try {
158
//#define _CATCH(x) } catch (x) {
159
//#define _CATCH_ALL } catch (...) {
160
//#define _CATCH_END }
161
//#define _RAISE(x) throw (x)
162
//#define _RERAISE throw
163
#include <xstddef>
164
165
// Undefine them, and redefine with macros that will do nothing.
166
#ifdef _TRY_BEGIN
167
#undef _TRY_BEGIN
168
#endif
169
170
#define _TRY_BEGIN {
171
172
#ifdef _CATCH_ALL
173
#undef _CATCH_ALL
174
#endif
175
176
#define _CATCH_ALL } if(0) {
177
178
#ifdef _RAISE
179
#undef _RAISE
180
#endif
181
182
#define _RAISE(x) (x)
183
184
#ifdef _RERAISE
185
#undef _RERAISE
186
#endif
187
188
#define _RERAISE
189
190
#ifdef _CATCH_END
191
#undef _CATCH_END
192
#endif
193
194
#define _CATCH_END }
195
196
#endif
197
198
#endif
199
#endif
200
201
// Compiler Dependent Settings *************************************************
202
203
#ifdef _WIN32
204
// Disable windows definition of the min/max macros in favor of std templates.
205
# define NOMINMAX
206
#ifdef min
207
# undef min
208
#endif
209
210
#ifdef max
211
# undef max
212
#endif
213
214
# include <algorithm>
215
using
std::min;
216
using
std::max;
217
#endif
218
219
// Create a definition for __stdcall calling convention.
220
#ifndef _WIN32
221
# define __stdcall
222
#endif
223
224
#endif
Generated on Sat May 9 2015 21:25:05 for Alchemy by
1.8.3.1