1 #ifndef INC_config_hpp__
2 #define INC_config_hpp__
4 /* ANTLR Translator Generator
5 * Project led by Terence Parr at http://www.jGuru.com
6 * Software rights: http://www.antlr.org/license.html
8 * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/config.hpp#2 $
12 * Just a simple configuration file to differentiate between the
13 * various compilers used and reconfigure stuff for any oddities of the
14 * compiler in question.
16 * These are the defaults. Per compiler these are amended.
18 #define ANTLR_USE_NAMESPACE(_x_) _x_::
19 #define ANTLR_USING_NAMESPACE(_x_) using namespace _x_;
20 #define ANTLR_CXX_SUPPORTS_NAMESPACE 1
21 #define ANTLR_C_USING(_x_)
26 #define ANTLR_IOS_BASE ios_base
27 /** define if cctype functions/macros need a std:: prefix. A lot of compilers
28 * define these as macros, in which case something barfs.
30 #define ANTLR_CCTYPE_NEEDS_STD
32 /// Define if C++ compiler supports std::uncaught_exception
33 #define ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION
35 #define ANTLR_ATOI_IN_STD
37 /******************************************************************************/
38 /*{{{ Microsoft Visual C++ */
39 // NOTE: If you provide patches for a specific MSVC version guard them for
40 // the specific version!!!!
41 // _MSC_VER == 1100 for Microsoft Visual C++ 5.0
42 // _MSC_VER == 1200 for Microsoft Visual C++ 6.0
43 // _MSC_VER == 1300 for Microsoft Visual C++ 7.0
48 # pragma warning(disable : 4786)
52 // This warning really gets on my nerves.
53 // It's the one about symbol longer than 256 chars, and it happens
54 // all the time with STL.
55 # pragma warning( disable : 4786 4231 )
56 // this shuts up some DLL interface warnings for STL
57 # pragma warning( disable : 4251 )
59 # ifdef ANTLR_CXX_USE_STLPORT
60 # undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION
63 # if ( _MSC_VER < 1300 ) && ( defined(ANTLR_EXPORTS) || defined(ANTLR_IMPORTS) )
64 # error "DLL Build not supported on these MSVC versions."
65 // see comment in lib/cpp/src/dll.cpp
68 // For the DLL support originally contributed by Stephen Naughton
69 // If you are building statically leave ANTLR_EXPORTS/ANTLR_IMPORTS undefined
70 // If you are building the DLL define ANTLR_EXPORTS
71 // If you are compiling code to be used with the DLL define ANTLR_IMPORTS
74 # define ANTLR_API __declspec(dllexport)
79 # define ANTLR_API __declspec(dllimport)
82 # if ( _MSC_VER < 1200 )
83 // supposedly only for MSVC5 and before...
84 // Using vector<XXX> requires operator<(X,X) to be defined
85 # define NEEDS_OPERATOR_LESS_THAN
89 # if ( _MSC_VER == 1200 )
90 # undef ANTLR_ATOI_IN_STD
93 # if ( _MSC_VER < 1310 )
94 // Supposedly only for MSVC7 and before...
95 // Not allowed to put 'static const int XXX=20;' in a class definition
96 # define NO_STATIC_CONSTS
97 # define NO_TEMPLATE_PARTS
100 // No strcasecmp in the C library (so use stricmp instead)
101 // - Anyone know which is in which standard?
102 # define NO_STRCASECMP
103 # undef ANTLR_CCTYPE_NEEDS_STD
104 # define NO_STATIC_CONSTS
105 #endif // End of Microsoft Visual C++
108 /******************************************************************************/
109 /*{{{ SunPro Compiler (Using OBJECTSPACE STL)
110 *****************************************************************************/
113 # if (__SUNPRO_CC >= 0x500)
115 # define NEEDS_OPERATOR_LESS_THAN
116 # define NO_TEMPLATE_PARTS
123 # if (__SUNPRO_CC == 0x420)
125 /* This code is specif to SunWspro Compiler 4.2, and will compile with
126 the objectspace 2.1 toolkit for Solaris2.6 */
127 # define HAS_NOT_CASSERT_H
128 # define HAS_NOT_CSTRING_H
129 # define HAS_NOT_CCTYPE_H
130 # define HAS_NOT_CSTDIO_H
131 # define HAS_OSTREAM_H
133 /* #define OS_SOLARIS_2_6
134 #define OS_NO_WSTRING
135 #define OS_NO_ALLOCATORS
136 #define OS_MULTI_THREADED
137 #define OS_SOLARIS_NATIVE
139 #define __OSVERSION__=5
143 // ObjectSpace + some specific templates constructions with stl.
144 /* #define OS_NO_ALLOCATOR */
146 // This great compiler does not have the namespace feature.
147 # undef ANTLR_USE_NAMESPACE
148 # define ANTLR_USE_NAMESPACE(_x_)
149 # undef ANTLR_USING_NAMESPACE
150 # define ANTLR_USING_NAMESPACE(_x_)
151 # undef ANTLR_CXX_SUPPORTS_NAMESPACE
152 # endif // End __SUNPRO_CC == 0x420
157 # define exception os_exception
158 # define bad_exception os_bad_exception
160 // Not allowed to put 'static const int XXX=20;' in a class definition
161 # define NO_STATIC_CONSTS
162 // Using vector<XXX> requires operator<(X,X) to be defined
163 # define NEEDS_OPERATOR_LESS_THAN
167 # undef ANTLR_CCTYPE_NEEDS_STD
169 #endif // end __SUNPRO_CC
171 /*****************************************************************************/
172 /*{{{ Inprise C++ Builder 3.0
173 *****************************************************************************/
174 #ifdef __BCPLUSPLUS__
175 # define NO_TEMPLATE_PARTS
176 # define NO_STRCASECMP
177 # undef ANTLR_CCTYPE_NEEDS_STD
178 #endif // End of C++ Builder 3.0
180 /*****************************************************************************/
181 /*{{{ IBM VisualAge C++ ( which includes the Dinkumware C++ Library )
182 *****************************************************************************/
185 // No strcasecmp in the C library (so use stricmp instead)
186 // - Anyone know which is in which standard?
187 #if (defined(_AIX) && (__IBMCPP__ >= 600))
188 # define NO_STATIC_CONSTS
190 # define NO_STRCASECMP
191 # undef ANTLR_CCTYPE_NEEDS_STD
194 #endif // end IBM VisualAge C++
196 /*****************************************************************************/
197 /*{{{ Metrowerks Codewarrior
198 *****************************************************************************/
200 # if (__MWERKS__ <= 0x2201)
201 # define NO_TEMPLATE_PARTS
204 // CW 6.0 and 7.0 still do not have it.
205 # define ANTLR_REALLY_NO_STRCASECMP
207 # undef ANTLR_C_USING
208 # define ANTLR_C_USING(_x_) using std:: ## _x_;
210 # define ANTLR_CCTYPE_NEEDS_STD
211 # undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION
213 #endif // End of Metrowerks Codewarrior
215 /*****************************************************************************/
216 /*{{{ SGI Irix 6.5.10 MIPSPro compiler
217 *****************************************************************************/
218 // (contributed by Anna Winkler)
219 // Note: you can't compile ANTLR with the MIPSPro compiler on
220 // anything < 6.5.10 because SGI just fixed a big bug dealing with
221 // namespaces in that release.
223 # define HAS_NOT_CCTYPE_H
224 # define HAS_NOT_CSTRING_H
225 # define HAS_NOT_CSTDIO_H
226 # undef ANTLR_CCTYPE_NEEDS_STD
227 #endif // End IRIX MIPSPro
229 /*****************************************************************************/
230 /*{{{ G++ in various incarnations
231 *****************************************************************************/
232 // With the gcc-2.95 and 3.0 being in the near future we should start handling
233 // incompatabilities between the various libstdc++'s.
234 #if defined(__GNUC__) || defined(__GNUG__)
236 # if (__GNUC__ == 2 )
237 # if (__GNUC_MINOR__ <= 8 )
238 # undef ANTLR_USE_NAMESPACE
239 # define ANTLR_USE_NAMESPACE(_x_)
240 # undef ANTLR_USING_NAMESPACE
241 # define ANTLR_USING_NAMESPACE(_x_)
242 # undef ANTLR_CXX_SUPPORTS_NAMESPACE
244 # if (__GNUC_MINOR__ > 8 && __GNUC_MINOR__ <= 95 )
245 # undef ANTLR_IOS_BASE
246 # define ANTLR_IOS_BASE ios
247 # undef ANTLR_CCTYPE_NEEDS_STD
248 // compiling with -ansi ?
249 # ifdef __STRICT_ANSI__
250 # undef ANTLR_REALLY_NO_STRCASECMP
251 # define ANTLR_REALLY_NO_STRCASECMP
254 // experimental .96 .97 branches..
255 # undef ANTLR_CCTYPE_NEEDS_STD
260 /*****************************************************************************/
261 /*{{{ Digital CXX (Tru64)
262 *****************************************************************************/
264 #define __USE_STD_IOSTREAM
267 /*****************************************************************************/
269 # if __BORLANDC__ >= 560
272 # define ANTLR_CCTYPE_NEEDS_STD
274 # error "sorry, compiler is too old - consider an update."
278 // Redefine these for backwards compatability..
279 #undef ANTLR_BEGIN_NAMESPACE
280 #undef ANTLR_END_NAMESPACE
282 #if ANTLR_CXX_SUPPORTS_NAMESPACE == 1
283 # define ANTLR_BEGIN_NAMESPACE(_x_) namespace _x_ {
284 # define ANTLR_END_NAMESPACE }
286 # define ANTLR_BEGIN_NAMESPACE(_x_)
287 # define ANTLR_END_NAMESPACE
290 #endif //INC_config_hpp__