ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/antlr/config.hpp
Revision: 2511
Committed: Thu Dec 15 14:48:26 2005 UTC (18 years, 7 months ago) by gezelter
File size: 8071 byte(s)
Log Message:
Removing compiler dependencies and replacing them with real autoconf
checks

File Contents

# User Rev Content
1 tim 2469 #ifndef INC_config_hpp__
2     #define INC_config_hpp__
3    
4     /* ANTLR Translator Generator
5     * Project led by Terence Parr at http://www.jGuru.com
6     * Software rights: http://www.antlr.org/license.html
7     *
8 gezelter 2511 * $Id: config.hpp,v 1.2 2005-12-15 14:48:26 gezelter Exp $
9 tim 2469 */
10    
11     /*
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.
15     *
16     * These are the defaults. Per compiler these are amended.
17     */
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_)
22     #define ANTLR_API
23     #ifndef CUSTOM_API
24     # define CUSTOM_API
25     #endif
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.
29     */
30     #define ANTLR_CCTYPE_NEEDS_STD
31    
32     /// Define if C++ compiler supports std::uncaught_exception
33     #define ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION
34    
35     #define ANTLR_ATOI_IN_STD
36    
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
44     #if defined(_MSC_VER)
45    
46     // This warning really gets on my nerves.
47     // It's the one about symbol longer than 256 chars, and it happens
48     // all the time with STL.
49     # pragma warning( disable : 4786 4231 )
50     // this shuts up some DLL interface warnings for STL
51     # pragma warning( disable : 4251 )
52    
53     # ifdef ANTLR_CXX_USE_STLPORT
54     # undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION
55     # endif
56    
57     # if ( _MSC_VER < 1300 ) && ( defined(ANTLR_EXPORTS) || defined(ANTLR_IMPORTS) )
58     # error "DLL Build not supported on these MSVC versions."
59     // see comment in lib/cpp/src/dll.cpp
60     # endif
61    
62     // For the DLL support originally contributed by Stephen Naughton
63     // If you are building statically leave ANTLR_EXPORTS/ANTLR_IMPORTS undefined
64     // If you are building the DLL define ANTLR_EXPORTS
65     // If you are compiling code to be used with the DLL define ANTLR_IMPORTS
66     # ifdef ANTLR_EXPORTS
67     # undef ANTLR_API
68     # define ANTLR_API __declspec(dllexport)
69     # endif
70    
71     # ifdef ANTLR_IMPORTS
72     # undef ANTLR_API
73     # define ANTLR_API __declspec(dllimport)
74     # endif
75    
76     // VC6
77     # if ( _MSC_VER == 1200 )
78     # undef ANTLR_ATOI_IN_STD
79     # endif
80    
81     // These should be verified for newer MSVC's
82     // Not allowed to put 'static const int XXX=20;' in a class definition
83     # define NO_STATIC_CONSTS
84     // Using vector<XXX> requires operator<(X,X) to be defined
85     # define NEEDS_OPERATOR_LESS_THAN
86     // No strcasecmp in the C library (so use stricmp instead)
87     // - Anyone know which is in which standard?
88     # undef ANTLR_CCTYPE_NEEDS_STD
89    
90     // needed for CharScannerLiteralsLess
91     # define NO_TEMPLATE_PARTS
92    
93     #endif // End of Microsoft Visual C++
94    
95     /*}}}*/
96     /******************************************************************************/
97     /*{{{ SunPro Compiler (Using OBJECTSPACE STL)
98     *****************************************************************************/
99     #ifdef __SUNPRO_CC
100    
101     # if (__SUNPRO_CC >= 0x500)
102    
103     # define NEEDS_OPERATOR_LESS_THAN
104     # define NO_TEMPLATE_PARTS
105    
106     # else
107    
108     # undef namespace
109     # define namespace
110    
111     # if (__SUNPRO_CC == 0x420)
112    
113     /* This code is specif to SunWspro Compiler 4.2, and will compile with
114     the objectspace 2.1 toolkit for Solaris2.6 */
115     # define HAS_NOT_CASSERT_H
116     # define HAS_NOT_CSTRING_H
117     # define HAS_NOT_CCTYPE_H
118     # define HAS_NOT_CSTDIO_H
119     # define HAS_OSTREAM_H
120    
121     /* #define OS_SOLARIS_2_6
122     #define OS_NO_WSTRING
123     #define OS_NO_ALLOCATORS
124     #define OS_MULTI_THREADED
125     #define OS_SOLARIS_NATIVE
126     #define OS_REALTIME
127     #define __OSVERSION__=5
128     #define SVR4
129     */
130    
131     // ObjectSpace + some specific templates constructions with stl.
132     /* #define OS_NO_ALLOCATOR */
133    
134     // This great compiler does not have the namespace feature.
135     # undef ANTLR_USE_NAMESPACE
136     # define ANTLR_USE_NAMESPACE(_x_)
137     # undef ANTLR_USING_NAMESPACE
138     # define ANTLR_USING_NAMESPACE(_x_)
139     # undef ANTLR_CXX_SUPPORTS_NAMESPACE
140     # endif // End __SUNPRO_CC == 0x420
141    
142     # undef explicit
143     # define explicit
144    
145     # define exception os_exception
146     # define bad_exception os_bad_exception
147    
148     // Not allowed to put 'static const int XXX=20;' in a class definition
149     # define NO_STATIC_CONSTS
150     // Using vector<XXX> requires operator<(X,X) to be defined
151     # define NEEDS_OPERATOR_LESS_THAN
152    
153     # endif
154    
155     # undef ANTLR_CCTYPE_NEEDS_STD
156    
157     #endif // end __SUNPRO_CC
158     /*}}}*/
159     /*****************************************************************************/
160     /*{{{ Inprise C++ Builder 3.0
161     *****************************************************************************/
162     #ifdef __BCPLUSPLUS__
163     # define NO_TEMPLATE_PARTS
164     # undef ANTLR_CCTYPE_NEEDS_STD
165     #endif // End of C++ Builder 3.0
166     /*}}}*/
167     /*****************************************************************************/
168     /*{{{ IBM VisualAge C++ ( which includes the Dinkumware C++ Library )
169     *****************************************************************************/
170     #ifdef __IBMCPP__
171    
172     // No strcasecmp in the C library (so use stricmp instead)
173     // - Anyone know which is in which standard?
174     # undef ANTLR_CCTYPE_NEEDS_STD
175    
176     #endif // end IBM VisualAge C++
177     /*}}}*/
178     /*****************************************************************************/
179     /*{{{ Metrowerks Codewarrior
180     *****************************************************************************/
181     #ifdef __MWERKS__
182     # if (__MWERKS__ <= 0x2201)
183     # define NO_TEMPLATE_PARTS
184     # endif
185    
186     // CW 6.0 and 7.0 still do not have it.
187    
188     # undef ANTLR_C_USING
189     # define ANTLR_C_USING(_x_) using std:: ## _x_;
190    
191     # define ANTLR_CCTYPE_NEEDS_STD
192     # undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION
193    
194     #endif // End of Metrowerks Codewarrior
195     /*}}}*/
196     /*****************************************************************************/
197     /*{{{ SGI Irix 6.5.10 MIPSPro compiler
198     *****************************************************************************/
199     // (contributed by Anna Winkler)
200     // Note: you can't compile ANTLR with the MIPSPro compiler on
201     // anything < 6.5.10 because SGI just fixed a big bug dealing with
202     // namespaces in that release.
203     #ifdef __sgi
204     # define HAS_NOT_CCTYPE_H
205     # define HAS_NOT_CSTRING_H
206     # define HAS_NOT_CSTDIO_H
207     # undef ANTLR_CCTYPE_NEEDS_STD
208     #endif // End IRIX MIPSPro
209     /*}}}*/
210     /*****************************************************************************/
211     /*{{{ G++ in various incarnations
212     *****************************************************************************/
213     // With the gcc-2.95 and 3.0 being in the near future we should start handling
214     // incompatabilities between the various libstdc++'s.
215     #if defined(__GNUC__) || defined(__GNUG__)
216     // gcc 2 branch..
217     # if (__GNUC__ == 2 )
218     # if (__GNUC_MINOR__ <= 8 )
219     # undef ANTLR_USE_NAMESPACE
220     # define ANTLR_USE_NAMESPACE(_x_)
221     # undef ANTLR_USING_NAMESPACE
222     # define ANTLR_USING_NAMESPACE(_x_)
223     # undef ANTLR_CXX_SUPPORTS_NAMESPACE
224     # endif
225     # if (__GNUC_MINOR__ > 8 && __GNUC_MINOR__ <= 95 )
226     # undef ANTLR_IOS_BASE
227     # define ANTLR_IOS_BASE ios
228     # undef ANTLR_CCTYPE_NEEDS_STD
229     # else
230     // experimental .96 .97 branches..
231     # undef ANTLR_CCTYPE_NEEDS_STD
232     # endif
233     # endif
234     #endif // ! __GNUC__
235     /*}}}*/
236     /*****************************************************************************/
237     /*{{{ Digital CXX (Tru64)
238     *****************************************************************************/
239     #ifdef __DECCXX
240     #define __USE_STD_IOSTREAM
241     #endif
242     /*}}}*/
243     /*****************************************************************************/
244     #ifdef __BORLANDC__
245     #if __BORLANDC__ >= 560
246     #include <ctype>
247     #include <stdlib>
248     #define ANTLR_CCTYPE_NEEDS_STD
249     #else
250     #error "sorry, compiler is too old - consider an update."
251     #endif
252     #endif
253    
254     // Redefine these for backwards compatability..
255     #undef ANTLR_BEGIN_NAMESPACE
256     #undef ANTLR_END_NAMESPACE
257    
258     #if ANTLR_CXX_SUPPORTS_NAMESPACE == 1
259     # define ANTLR_BEGIN_NAMESPACE(_x_) namespace _x_ {
260     # define ANTLR_END_NAMESPACE }
261     #else
262     # define ANTLR_BEGIN_NAMESPACE(_x_)
263     # define ANTLR_END_NAMESPACE
264     #endif
265    
266     #endif //INC_config_hpp__