ANTLR Support Libraries 2.7.1+
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines
antlr/config.hpp
Go to the documentation of this file.
00001 #ifndef INC_config_hpp__
00002 #define INC_config_hpp__
00003 
00004 /* ANTLR Translator Generator
00005  * Project led by Terence Parr at http://www.jGuru.com
00006  * Software rights: http://www.antlr.org/license.html
00007  *
00008  * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/config.hpp#2 $
00009  */
00010 
00011 /*
00012  * Just a simple configuration file to differentiate between the
00013  * various compilers used and reconfigure stuff for any oddities of the
00014  * compiler in question.
00015  *
00016  * These are the defaults. Per compiler these are amended.
00017  */
00018 #define ANTLR_USE_NAMESPACE(_x_) _x_::
00019 #define ANTLR_USING_NAMESPACE(_x_) using namespace _x_;
00020 #define ANTLR_CXX_SUPPORTS_NAMESPACE 1
00021 #define ANTLR_C_USING(_x_)
00022 #define ANTLR_API
00023 #ifndef CUSTOM_API
00024 # define CUSTOM_API
00025 #endif
00026 #define ANTLR_IOS_BASE ios_base
00027 
00030 #define ANTLR_CCTYPE_NEEDS_STD
00031 
00033 #define ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION
00034 
00035 #define ANTLR_ATOI_IN_STD
00036 
00037 /******************************************************************************/
00038 /*{{{ Microsoft Visual C++ */
00039 // NOTE: If you provide patches for a specific MSVC version guard them for
00040 // the specific version!!!!
00041 // _MSC_VER == 1100 for Microsoft Visual C++ 5.0
00042 // _MSC_VER == 1200 for Microsoft Visual C++ 6.0
00043 // _MSC_VER == 1300 for Microsoft Visual C++ 7.0
00044 #if defined(_MSC_VER)
00045 
00046 # if _MSC_VER < 1300
00047 #  define NOMINMAX
00048 #  pragma warning(disable : 4786)
00049 #  define min _cpp_min
00050 # endif
00051 
00052 // This warning really gets on my nerves.
00053 // It's the one about symbol longer than 256 chars, and it happens
00054 // all the time with STL.
00055 # pragma warning( disable : 4786 4231 )
00056 // this shuts up some DLL interface warnings for STL
00057 # pragma warning( disable : 4251 )
00058 
00059 # ifdef ANTLR_CXX_USE_STLPORT
00060 #  undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION
00061 # endif
00062 
00063 # if ( _MSC_VER < 1300 ) && ( defined(ANTLR_EXPORTS) || defined(ANTLR_IMPORTS) )
00064 #  error "DLL Build not supported on these MSVC versions."
00065 // see comment in lib/cpp/src/dll.cpp
00066 # endif
00067 
00068 // For the DLL support originally contributed by Stephen Naughton
00069 // If you are building statically leave ANTLR_EXPORTS/ANTLR_IMPORTS undefined
00070 // If you are building the DLL define ANTLR_EXPORTS
00071 // If you are compiling code to be used with the DLL define ANTLR_IMPORTS
00072 # ifdef ANTLR_EXPORTS
00073 #  undef ANTLR_API
00074 #  define ANTLR_API __declspec(dllexport)
00075 # endif
00076 
00077 # ifdef ANTLR_IMPORTS
00078 #  undef ANTLR_API
00079 #  define ANTLR_API __declspec(dllimport)
00080 # endif
00081 
00082 # if ( _MSC_VER < 1200 )
00083 // supposedly only for MSVC5 and before...
00084 // Using vector<XXX> requires operator<(X,X) to be defined
00085 #  define NEEDS_OPERATOR_LESS_THAN
00086 # endif
00087 
00088 // VC6
00089 # if ( _MSC_VER == 1200 )
00090 #  undef ANTLR_ATOI_IN_STD
00091 # endif
00092 
00093 # if ( _MSC_VER < 1310 )
00094 // Supposedly only for MSVC7 and before...
00095 // Not allowed to put 'static const int XXX=20;' in a class definition
00096 #  define NO_STATIC_CONSTS
00097 #  define NO_TEMPLATE_PARTS
00098 # endif
00099 
00100 // No strcasecmp in the C library (so use stricmp instead)
00101 // - Anyone know which is in which standard?
00102 # define NO_STRCASECMP
00103 # undef ANTLR_CCTYPE_NEEDS_STD
00104 #  define NO_STATIC_CONSTS
00105 #endif   // End of Microsoft Visual C++
00106 
00107 /*}}}*/
00108 /******************************************************************************/
00109 /*{{{ SunPro Compiler (Using OBJECTSPACE STL)
00110  *****************************************************************************/
00111 #ifdef __SUNPRO_CC
00112 
00113 # if (__SUNPRO_CC >= 0x500)
00114 
00115 #  define NEEDS_OPERATOR_LESS_THAN
00116 #  define NO_TEMPLATE_PARTS
00117 
00118 # else
00119 
00120 #  undef namespace
00121 #  define namespace
00122 
00123 #  if (__SUNPRO_CC == 0x420)
00124 
00125 /* This code is specif to SunWspro Compiler 4.2, and will compile with
00126  the objectspace 2.1 toolkit for Solaris2.6 */
00127 #   define HAS_NOT_CASSERT_H
00128 #   define HAS_NOT_CSTRING_H
00129 #   define HAS_NOT_CCTYPE_H
00130 #   define HAS_NOT_CSTDIO_H
00131 #   define HAS_OSTREAM_H
00132 
00133 /* #define OS_SOLARIS_2_6
00134  #define OS_NO_WSTRING
00135  #define OS_NO_ALLOCATORS
00136  #define OS_MULTI_THREADED
00137  #define OS_SOLARIS_NATIVE
00138  #define OS_REALTIME
00139  #define __OSVERSION__=5
00140  #define SVR4
00141  */
00142 
00143 // ObjectSpace + some specific templates constructions with stl.
00144 /* #define OS_NO_ALLOCATOR */
00145 
00146 // This great compiler does not have the namespace feature.
00147 #   undef  ANTLR_USE_NAMESPACE
00148 #   define ANTLR_USE_NAMESPACE(_x_)
00149 #   undef ANTLR_USING_NAMESPACE
00150 #   define ANTLR_USING_NAMESPACE(_x_)
00151 #   undef ANTLR_CXX_SUPPORTS_NAMESPACE
00152 #  endif    // End __SUNPRO_CC == 0x420
00153 
00154 #  undef explicit
00155 #  define explicit
00156 
00157 #  define exception os_exception
00158 #  define bad_exception os_bad_exception
00159 
00160 // Not allowed to put 'static const int XXX=20;' in a class definition
00161 #  define NO_STATIC_CONSTS
00162 // Using vector<XXX> requires operator<(X,X) to be defined
00163 #  define NEEDS_OPERATOR_LESS_THAN
00164 
00165 # endif
00166 
00167 # undef ANTLR_CCTYPE_NEEDS_STD
00168 
00169 #endif   // end __SUNPRO_CC
00170 /*}}}*/
00171 /*****************************************************************************/
00172 /*{{{ Inprise C++ Builder 3.0
00173  *****************************************************************************/
00174 #ifdef __BCPLUSPLUS__
00175 # define NO_TEMPLATE_PARTS
00176 # define NO_STRCASECMP
00177 # undef ANTLR_CCTYPE_NEEDS_STD
00178 #endif   // End of C++ Builder 3.0
00179 /*}}}*/
00180 /*****************************************************************************/
00181 /*{{{ IBM VisualAge C++ ( which includes the Dinkumware C++ Library )
00182  *****************************************************************************/
00183 #ifdef __IBMCPP__
00184 
00185 // No strcasecmp in the C library (so use stricmp instead)
00186 // - Anyone know which is in which standard?
00187 #if (defined(_AIX) && (__IBMCPP__ >= 600))
00188 # define NO_STATIC_CONSTS
00189 #else
00190 # define NO_STRCASECMP
00191 # undef ANTLR_CCTYPE_NEEDS_STD
00192 #endif
00193 
00194 #endif   // end IBM VisualAge C++
00195 /*}}}*/
00196 /*****************************************************************************/
00197 /*{{{ Metrowerks Codewarrior
00198  *****************************************************************************/
00199 #ifdef __MWERKS__
00200 # if (__MWERKS__ <= 0x2201)
00201 #  define NO_TEMPLATE_PARTS
00202 # endif
00203 
00204 // CW 6.0 and 7.0 still do not have it.
00205 # define ANTLR_REALLY_NO_STRCASECMP
00206 
00207 # undef ANTLR_C_USING
00208 # define ANTLR_C_USING(_x_)   using std:: ## _x_;
00209 
00210 # define ANTLR_CCTYPE_NEEDS_STD
00211 # undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION
00212 
00213 #endif   // End of Metrowerks Codewarrior
00214 /*}}}*/
00215 /*****************************************************************************/
00216 /*{{{ SGI Irix 6.5.10 MIPSPro compiler
00217  *****************************************************************************/
00218 // (contributed by Anna Winkler)
00219 // Note: you can't compile ANTLR with the MIPSPro compiler on
00220 // anything < 6.5.10 because SGI just fixed a big bug dealing with
00221 // namespaces in that release.
00222 #ifdef __sgi
00223 # define HAS_NOT_CCTYPE_H
00224 # define HAS_NOT_CSTRING_H
00225 # define HAS_NOT_CSTDIO_H
00226 # undef ANTLR_CCTYPE_NEEDS_STD
00227 #endif // End IRIX MIPSPro
00228 /*}}}*/
00229 /*****************************************************************************/
00230 /*{{{ G++ in various incarnations
00231  *****************************************************************************/
00232 // With the gcc-2.95 and 3.0 being in the near future we should start handling
00233 // incompatabilities between the various libstdc++'s.
00234 #if defined(__GNUC__) || defined(__GNUG__)
00235 // gcc 2 branch..
00236 # if (__GNUC__ == 2 )
00237 #  if (__GNUC_MINOR__ <= 8 )
00238 #   undef ANTLR_USE_NAMESPACE
00239 #   define ANTLR_USE_NAMESPACE(_x_)
00240 #   undef ANTLR_USING_NAMESPACE
00241 #   define ANTLR_USING_NAMESPACE(_x_)
00242 #   undef ANTLR_CXX_SUPPORTS_NAMESPACE
00243 #  endif
00244 #  if (__GNUC_MINOR__ > 8 && __GNUC_MINOR__ <= 95 )
00245 #    undef ANTLR_IOS_BASE
00246 #    define ANTLR_IOS_BASE ios
00247 #    undef ANTLR_CCTYPE_NEEDS_STD
00248 // compiling with -ansi ?
00249 #    ifdef __STRICT_ANSI__
00250 #     undef ANTLR_REALLY_NO_STRCASECMP
00251 #     define ANTLR_REALLY_NO_STRCASECMP
00252 #    endif
00253 #  else
00254 // experimental .96 .97 branches..
00255 #   undef ANTLR_CCTYPE_NEEDS_STD
00256 #  endif
00257 # endif
00258 #endif // ! __GNUC__
00259 /*}}}*/
00260 /*****************************************************************************/
00261 /*{{{ Digital CXX (Tru64)
00262  *****************************************************************************/
00263 #ifdef __DECCXX
00264 #define __USE_STD_IOSTREAM
00265 #endif
00266 /*}}}*/
00267 /*****************************************************************************/
00268 #ifdef __BORLANDC__
00269 # if  __BORLANDC__ >= 560
00270 #  include <ctype>
00271 #  include <stdlib>
00272 #  define ANTLR_CCTYPE_NEEDS_STD
00273 # else
00274 #  error "sorry, compiler is too old - consider an update."
00275 # endif
00276 #endif
00277 
00278 // Redefine these for backwards compatability..
00279 #undef ANTLR_BEGIN_NAMESPACE
00280 #undef ANTLR_END_NAMESPACE
00281 
00282 #if ANTLR_CXX_SUPPORTS_NAMESPACE == 1
00283 # define ANTLR_BEGIN_NAMESPACE(_x_) namespace _x_ {
00284 # define ANTLR_END_NAMESPACE }
00285 #else
00286 # define ANTLR_BEGIN_NAMESPACE(_x_)
00287 # define ANTLR_END_NAMESPACE
00288 #endif
00289 
00290 #endif //INC_config_hpp__