summaryrefslogtreecommitdiffstats
path: root/lib/antlr/antlr/config.h
blob: 4d3456ec1c92a460b93c840c0c5fea5616e02db8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
#ifndef INC_config_h__
#define INC_config_h__

/* ANTLR Translator Generator
 * Project led by Terence Parr at http://www.jGuru.com
 * Software rights: http://www.antlr.org/license.html
 *
 * $Id$
 */

/*
 * Just a simple configuration file to differentiate between the
 * various compilers used and reconfigure stuff for any oddities of the
 * compiler in question.
 *
 * These are the defaults. Per compiler these are amended.
 */
#define ANTLR_USE_NAMESPACE(_x_) _x_::
#define ANTLR_USING_NAMESPACE(_x_) using namespace _x_;
#define ANTLR_CXX_SUPPORTS_NAMESPACE 1
#define ANTLR_C_USING(_x_)
#define ANTLR_API
#ifndef CUSTOM_API
# define CUSTOM_API
#endif
#define ANTLR_IOS_BASE ios_base
/** define if cctype functions/macros need a std:: prefix. A lot of compilers
 * define these as macros, in which case something barfs.
 */
#define ANTLR_CCTYPE_NEEDS_STD

/// Define if C++ compiler supports std::uncaught_exception
#define ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION

#define ANTLR_ATOI_IN_STD

/******************************************************************************/
/*{{{ Microsoft Visual C++ */
// NOTE: If you provide patches for a specific MSVC version guard them for
// the specific version!!!!
// _MSC_VER == 1100 for Microsoft Visual C++ 5.0
// _MSC_VER == 1200 for Microsoft Visual C++ 6.0
// _MSC_VER == 1300 for Microsoft Visual C++ 7.0
#if defined(_MSC_VER)

# if _MSC_VER < 1300
#	define NOMINMAX
#	pragma warning(disable : 4786)
#	define min _cpp_min
# endif

// This warning really gets on my nerves.
// It's the one about symbol longer than 256 chars, and it happens
// all the time with STL.
# pragma warning( disable : 4786 4231 )
// this shuts up some DLL interface warnings for STL
# pragma warning( disable : 4251 )

# ifdef ANTLR_CXX_USE_STLPORT
#	undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION
# endif

# if ( _MSC_VER < 1300 ) && ( defined(ANTLR_EXPORTS) || defined(ANTLR_IMPORTS) )
#	error "DLL Build not supported on these MSVC versions."
// see comment in lib/cpp/src/dll.cpp
# endif

// For the DLL support originally contributed by Stephen Naughton
// If you are building statically leave ANTLR_EXPORTS/ANTLR_IMPORTS undefined
// If you are building the DLL define ANTLR_EXPORTS
// If you are compiling code to be used with the DLL define ANTLR_IMPORTS
# ifdef ANTLR_EXPORTS
#	undef ANTLR_API
#	define ANTLR_API __declspec(dllexport)
# endif

# ifdef ANTLR_IMPORTS
#	undef ANTLR_API
#	define ANTLR_API __declspec(dllimport)
# endif

# if ( _MSC_VER < 1200 )
// supposedly only for MSVC5 and before...
// Using vector<XXX> requires operator<(X,X) to be defined
#	define NEEDS_OPERATOR_LESS_THAN
# endif

// VC6
# if ( _MSC_VER == 1200 )
#	undef ANTLR_ATOI_IN_STD
# endif

# if ( _MSC_VER < 1310 )
// Supposedly only for MSVC7 and before...
// Not allowed to put 'static const int XXX=20;' in a class definition
#	define NO_STATIC_CONSTS
#	define NO_TEMPLATE_PARTS
# endif

// No strcasecmp in the C library (so use stricmp instead)
// - Anyone know which is in which standard?
# define NO_STRCASECMP
# undef ANTLR_CCTYPE_NEEDS_STD
#	define NO_STATIC_CONSTS
#endif	// End of Microsoft Visual C++

/*}}}*/
/******************************************************************************/
/*{{{ SunPro Compiler (Using OBJECTSPACE STL)
 *****************************************************************************/
#ifdef __SUNPRO_CC

# if (__SUNPRO_CC >= 0x500)

#	define NEEDS_OPERATOR_LESS_THAN
#	define NO_TEMPLATE_PARTS

# else

#	undef namespace
#	define namespace

#	if (__SUNPRO_CC == 0x420)

/* This code is specif to SunWspro Compiler 4.2, and will compile with
 the objectspace 2.1 toolkit for Solaris2.6 */
#	 define HAS_NOT_CASSERT_H
#	 define HAS_NOT_CSTRING_H
#	 define HAS_NOT_CCTYPE_H
#	 define HAS_NOT_CSTDIO_H
#	 define HAS_OSTREAM_H

/* #define OS_SOLARIS_2_6
 #define OS_NO_WSTRING
 #define OS_NO_ALLOCATORS
 #define OS_MULTI_THREADED
 #define OS_SOLARIS_NATIVE
 #define OS_REALTIME
 #define __OSVERSION__=5
 #define SVR4
 */

// ObjectSpace + some specific templates constructions with stl.
/* #define OS_NO_ALLOCATOR */

// This great compiler does not have the namespace feature.
#	 undef  ANTLR_USE_NAMESPACE
#	 define ANTLR_USE_NAMESPACE(_x_)
#	 undef ANTLR_USING_NAMESPACE
#	 define ANTLR_USING_NAMESPACE(_x_)
#	 undef ANTLR_CXX_SUPPORTS_NAMESPACE
#	endif		// End __SUNPRO_CC == 0x420

#	undef explicit
#	define explicit

#	define exception os_exception
#	define bad_exception os_bad_exception

// Not allowed to put 'static const int XXX=20;' in a class definition
#	define NO_STATIC_CONSTS
// Using vector<XXX> requires operator<(X,X) to be defined
#	define NEEDS_OPERATOR_LESS_THAN

# endif

# undef ANTLR_CCTYPE_NEEDS_STD

#endif	// end __SUNPRO_CC
/*}}}*/
/*****************************************************************************/
/*{{{ Inprise C++ Builder 3.0
 *****************************************************************************/
#ifdef __BCPLUSPLUS__
# define NO_TEMPLATE_PARTS
# define NO_STRCASECMP
# undef ANTLR_CCTYPE_NEEDS_STD
#endif	// End of C++ Builder 3.0
/*}}}*/
/*****************************************************************************/
/*{{{ IBM VisualAge C++ ( which includes the Dinkumware C++ Library )
 *****************************************************************************/
#ifdef __IBMCPP__

// No strcasecmp in the C library (so use stricmp instead)
// - Anyone know which is in which standard?
#if (defined(_AIX) && (__IBMCPP__ >= 600))
# define NO_STATIC_CONSTS
#else
# define NO_STRCASECMP
# undef ANTLR_CCTYPE_NEEDS_STD
#endif

#endif	// end IBM VisualAge C++
/*}}}*/
/*****************************************************************************/
/*{{{ Metrowerks Codewarrior
 *****************************************************************************/
#ifdef __MWERKS__
# if (__MWERKS__ <= 0x2201)
#	define NO_TEMPLATE_PARTS
# endif

// CW 6.0 and 7.0 still do not have it.
# define ANTLR_REALLY_NO_STRCASECMP

# undef ANTLR_C_USING
# define ANTLR_C_USING(_x_)   using std:: ## _x_;

# define ANTLR_CCTYPE_NEEDS_STD
# undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION

#endif	// End of Metrowerks Codewarrior
/*}}}*/
/*****************************************************************************/
/*{{{ SGI Irix 6.5.10 MIPSPro compiler
 *****************************************************************************/
// (contributed by Anna Winkler)
// Note: you can't compile ANTLR with the MIPSPro compiler on
// anything < 6.5.10 because SGI just fixed a big bug dealing with
// namespaces in that release.
#ifdef __sgi
# define HAS_NOT_CCTYPE_H
# define HAS_NOT_CSTRING_H
# define HAS_NOT_CSTDIO_H
# undef ANTLR_CCTYPE_NEEDS_STD
#endif // End IRIX MIPSPro
/*}}}*/
/*****************************************************************************/
/*{{{ G++ in various incarnations
 *****************************************************************************/
// With the gcc-2.95 and 3.0 being in the near future we should start handling
// incompatabilities between the various libstdc++'s.
#if defined(__GNUC__) || defined(__GNUG__)
// gcc 2 branch..
# if (__GNUC__ == 2 )
#	if (__GNUC_MINOR__ <= 8 )
#	 undef ANTLR_USE_NAMESPACE
#	 define ANTLR_USE_NAMESPACE(_x_)
#	 undef ANTLR_USING_NAMESPACE
#	 define ANTLR_USING_NAMESPACE(_x_)
#	 undef ANTLR_CXX_SUPPORTS_NAMESPACE
#	endif
#	if (__GNUC_MINOR__ > 8 && __GNUC_MINOR__ <= 95 )
#	  undef ANTLR_IOS_BASE
#	  define ANTLR_IOS_BASE ios
#	  undef ANTLR_CCTYPE_NEEDS_STD
// compiling with -ansi ?
#	  ifdef __STRICT_ANSI__
#		undef ANTLR_REALLY_NO_STRCASECMP
#		define ANTLR_REALLY_NO_STRCASECMP
#	  endif
#	else
// experimental .96 .97 branches..
#	 undef ANTLR_CCTYPE_NEEDS_STD
#	endif
# endif
#endif // ! __GNUC__
/*}}}*/
/*****************************************************************************/
/*{{{ Digital CXX (Tru64)
 *****************************************************************************/
#ifdef __DECCXX
#define __USE_STD_IOSTREAM
#endif
/*}}}*/
/*****************************************************************************/
#ifdef __BORLANDC__
# if  __BORLANDC__ >= 560
#	include <ctype>
#	include <stdlib>
#	define ANTLR_CCTYPE_NEEDS_STD
# else
#	error "sorry, compiler is too old - consider an update."
# endif
#endif

// Redefine these for backwards compatability..
#undef ANTLR_BEGIN_NAMESPACE
#undef ANTLR_END_NAMESPACE

#if ANTLR_CXX_SUPPORTS_NAMESPACE == 1
# define ANTLR_BEGIN_NAMESPACE(_x_) namespace _x_ {
# define ANTLR_END_NAMESPACE }
#else
# define ANTLR_BEGIN_NAMESPACE(_x_)
# define ANTLR_END_NAMESPACE
#endif

#endif //INC_config_h__