1 #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 * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/config.hpp#2 $ 9 */ 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 # if _MSC_VER < 1300 47 # define NOMINMAX 48 # pragma warning(disable : 4786) 49 # define min _cpp_min 50 # endif 51 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 ) 58 59 # ifdef ANTLR_CXX_USE_STLPORT 60 # undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION 61 # endif 62 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 66 # endif 67 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 72 # ifdef ANTLR_EXPORTS 73 # undef ANTLR_API 74 # define ANTLR_API __declspec(dllexport) 75 # endif 76 77 # ifdef ANTLR_IMPORTS 78 # undef ANTLR_API 79 # define ANTLR_API __declspec(dllimport) 80 # endif 81 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 86 # endif 87 88 // VC6 89 # if ( _MSC_VER == 1200 ) 90 # undef ANTLR_ATOI_IN_STD 91 # endif 92 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 98 # endif 99 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++ 106 107 /*}}}*/ 108 /******************************************************************************/ 109 /*{{{ SunPro Compiler (Using OBJECTSPACE STL) 110 *****************************************************************************/ 111 #ifdef __SUNPRO_CC 112 113 # if (__SUNPRO_CC >= 0x500) 114 115 # define NEEDS_OPERATOR_LESS_THAN 116 # define NO_TEMPLATE_PARTS 117 118 # else 119 120 # undef namespace 121 # define namespace 122 123 # if (__SUNPRO_CC == 0x420) 124 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 132 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 138 #define OS_REALTIME 139 #define __OSVERSION__=5 140 #define SVR4 141 */ 142 143 // ObjectSpace + some specific templates constructions with stl. 144 /* #define OS_NO_ALLOCATOR */ 145 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 153 154 # undef explicit 155 # define explicit 156 157 # define exception os_exception 158 # define bad_exception os_bad_exception 159 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 164 165 # endif 166 167 # undef ANTLR_CCTYPE_NEEDS_STD 168 169 #endif // end __SUNPRO_CC 170 /*}}}*/ 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 179 /*}}}*/ 180 /*****************************************************************************/ 181 /*{{{ IBM VisualAge C++ ( which includes the Dinkumware C++ Library ) 182 *****************************************************************************/ 183 #ifdef __IBMCPP__ 184 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 189 #else 190 # define NO_STRCASECMP 191 # undef ANTLR_CCTYPE_NEEDS_STD 192 #endif 193 194 #endif // end IBM VisualAge C++ 195 /*}}}*/ 196 /*****************************************************************************/ 197 /*{{{ Metrowerks Codewarrior 198 *****************************************************************************/ 199 #ifdef __MWERKS__ 200 # if (__MWERKS__ <= 0x2201) 201 # define NO_TEMPLATE_PARTS 202 # endif 203 204 // CW 6.0 and 7.0 still do not have it. 205 # define ANTLR_REALLY_NO_STRCASECMP 206 207 # undef ANTLR_C_USING 208 # define ANTLR_C_USING(_x_) using std:: ## _x_; 209 210 # define ANTLR_CCTYPE_NEEDS_STD 211 # undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION 212 213 #endif // End of Metrowerks Codewarrior 214 /*}}}*/ 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. 222 #ifdef __sgi 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 228 /*}}}*/ 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__) 235 // gcc 2 branch.. 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 243 # endif 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 252 # endif 253 # else 254 // experimental .96 .97 branches.. 255 # undef ANTLR_CCTYPE_NEEDS_STD 256 # endif 257 # endif 258 #endif // ! __GNUC__ 259 /*}}}*/ 260 /*****************************************************************************/ 261 /*{{{ Digital CXX (Tru64) 262 *****************************************************************************/ 263 #ifdef __DECCXX 264 #define __USE_STD_IOSTREAM 265 #endif 266 /*}}}*/ 267 /*****************************************************************************/ 268 #ifdef __BORLANDC__ 269 # if __BORLANDC__ >= 560 270 # include <ctype> 271 # include <stdlib> 272 # define ANTLR_CCTYPE_NEEDS_STD 273 # else 274 # error "sorry, compiler is too old - consider an update." 275 # endif 276 #endif 277 278 // Redefine these for backwards compatability.. 279 #undef ANTLR_BEGIN_NAMESPACE 280 #undef ANTLR_END_NAMESPACE 281 282 #if ANTLR_CXX_SUPPORTS_NAMESPACE == 1 283 # define ANTLR_BEGIN_NAMESPACE(_x_) namespace _x_ { 284 # define ANTLR_END_NAMESPACE } 285 #else 286 # define ANTLR_BEGIN_NAMESPACE(_x_) 287 # define ANTLR_END_NAMESPACE 288 #endif 289 290 #endif //INC_config_hpp__ 291