1 /* 2 * 3 * Copyright (c) 1994 4 * Hewlett-Packard Company 5 * 6 * Permission to use, copy, modify, distribute and sell this software 7 * and its documentation for any purpose is hereby granted without fee, 8 * provided that the above copyright notice appear in all copies and 9 * that both that copyright notice and this permission notice appear 10 * in supporting documentation. Hewlett-Packard Company makes no 11 * representations about the suitability of this software for any 12 * purpose. It is provided "as is" without express or implied warranty. 13 * 14 * Copyright (c) 1997 15 * Silicon Graphics 16 * 17 * Permission to use, copy, modify, distribute and sell this software 18 * and its documentation for any purpose is hereby granted without fee, 19 * provided that the above copyright notice appear in all copies and 20 * that both that copyright notice and this permission notice appear 21 * in supporting documentation. Silicon Graphics makes no 22 * representations about the suitability of this software for any 23 * purpose. It is provided "as is" without express or implied warranty. 24 * 25 */ 26 27 #ifndef __STL_CONFIG_H 28 # define __STL_CONFIG_H 29 30 // Flags: 31 // * __STL_NO_BOOL: defined if the compiler doesn't have bool as a builtin 32 // type. 33 // * __STL_HAS_WCHAR_T: defined if the compier has wchar_t as a builtin type. 34 // * __STL_NO_DRAND48: defined if the compiler doesn't have the drand48 35 // function. 36 // * __STL_STATIC_TEMPLATE_MEMBER_BUG: defined if the compiler can't handle 37 // static members of template classes. 38 // * __STL_CLASS_PARTIAL_SPECIALIZATION: defined if the compiler supports 39 // partial specialization of template classes. 40 // * __STL_PARTIAL_SPECIALIZATION_SYNTAX: defined if the compiler 41 // supports partial specialization syntax for full specialization of 42 // class templates. (Even if it doesn't actually support partial 43 // specialization itself.) 44 // * __STL_FUNCTION_TMPL_PARTIAL_ORDER: defined if the compiler supports 45 // partial ordering of function templates. (a.k.a partial specialization 46 // of function templates.) 47 // * __STL_MEMBER_TEMPLATES: defined if the compiler supports template 48 // member functions of classes. 49 // * __STL_MEMBER_TEMPLATE_CLASSES: defined if the compiler supports 50 // nested classes that are member templates of other classes. 51 // * __STL_EXPLICIT_FUNCTION_TMPL_ARGS: defined if the compiler 52 // supports calling a function template by providing its template 53 // arguments explicitly. 54 // * __STL_LIMITED_DEFAULT_TEMPLATES: defined if the compiler is unable 55 // to handle default template parameters that depend on previous template 56 // parameters. 57 // * __STL_NON_TYPE_TMPL_PARAM_BUG: defined if the compiler has trouble with 58 // function template argument deduction for non-type template parameters. 59 // * __SGI_STL_NO_ARROW_OPERATOR: defined if the compiler is unable 60 // to support the -> operator for iterators. 61 // * __STL_USE_EXCEPTIONS: defined if the compiler (in the current compilation 62 // mode) supports exceptions. 63 // * __STL_USE_NAMESPACES: defined if the compiler has the necessary 64 // support for namespaces. 65 // * __STL_NO_EXCEPTION_HEADER: defined if the compiler does not have a 66 // standard-conforming header <exception>. 67 // * __STL_SGI_THREADS: defined if this is being compiled for an SGI IRIX 68 // system in multithreaded mode, using native SGI threads instead of 69 // pthreads. 70 // * __STL_WIN32THREADS: defined if this is being compiled on a WIN32 71 // compiler in multithreaded mode. 72 // * __STL_LONG_LONG if the compiler has long long and unsigned long long 73 // types. (They're not in the C++ standard, but they are expected to be 74 // included in the forthcoming C9X standard.) 75 76 77 // User-settable macros that control compilation: 78 // * __STL_USE_SGI_ALLOCATORS: if defined, then the STL will use older 79 // SGI-style allocators, instead of standard-conforming allocators, 80 // even if the compiler supports all of the language features needed 81 // for standard-conforming allocators. 82 // * __STL_NO_NAMESPACES: if defined, don't put the library in namespace 83 // std, even if the compiler supports namespaces. 84 // * __STL_ASSERTIONS: if defined, then enable runtime checking through the 85 // __stl_assert macro. 86 // * _PTHREADS: if defined, use Posix threads for multithreading support. 87 // * _NOTHREADS: if defined, don't use any multithreading support. 88 89 90 // Other macros defined by this file: 91 92 // * bool, true, and false, if __STL_NO_BOOL is defined. 93 // * typename, as a null macro if it's not already a keyword. 94 // * explicit, as a null macro if it's not already a keyword. 95 // * namespace-related macros (__STD, __STL_BEGIN_NAMESPACE, etc.) 96 // * exception-related macros (__STL_TRY, __STL_UNWIND, etc.) 97 // * __stl_assert, either as a test or as a null macro, depending on 98 // whether or not __STL_ASSERTIONS is defined. 99 100 #ifdef _PTHREADS 101 # define __STL_PTHREADS 102 #endif 103 #ifdef _SOLTHREADS 104 # define __STL_SOLTHREADS 105 #endif 106 107 # if defined(__sgi) && !defined(__GNUC__) 108 # if !defined(_BOOL) 109 # define __STL_NO_BOOL 110 # endif 111 # if defined(_WCHAR_T_IS_KEYWORD) 112 # define __STL_HAS_WCHAR_T 113 # endif 114 # if !defined(_TYPENAME_IS_KEYWORD) 115 # define __STL_NEED_TYPENAME 116 # endif 117 # ifdef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES 118 # define __STL_CLASS_PARTIAL_SPECIALIZATION 119 # endif 120 # ifdef _MEMBER_TEMPLATES 121 # define __STL_MEMBER_TEMPLATES 122 # define __STL_MEMBER_TEMPLATE_CLASSES 123 # endif 124 # if defined(_MEMBER_TEMPLATE_KEYWORD) 125 # define __STL_MEMBER_TEMPLATE_KEYWORD 126 # endif 127 # if (_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32 128 # define __STL_MEMBER_TEMPLATE_KEYWORD 129 # endif 130 # if !defined(_EXPLICIT_IS_KEYWORD) 131 # define __STL_NEED_EXPLICIT 132 # endif 133 # ifdef __EXCEPTIONS 134 # define __STL_USE_EXCEPTIONS 135 # endif 136 # if (_COMPILER_VERSION >= 721) && defined(_NAMESPACES) 137 # define __STL_HAS_NAMESPACES 138 # endif 139 # if (_COMPILER_VERSION < 721) 140 # define __STL_NO_EXCEPTION_HEADER 141 # endif 142 # if !defined(_NOTHREADS) && !defined(__STL_PTHREADS) 143 # define __STL_SGI_THREADS 144 # endif 145 # if defined(_LONGLONG) && defined(_SGIAPI) && _SGIAPI 146 # define __STL_LONG_LONG 147 # endif 148 # endif 149 150 # ifdef __GNUC__ 151 # include <_G_config.h> 152 # define __STL_HAS_WCHAR_T 153 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) 154 # define __STL_STATIC_TEMPLATE_MEMBER_BUG 155 # define __STL_NEED_TYPENAME 156 # define __STL_NEED_EXPLICIT 157 # else 158 # define __STL_CLASS_PARTIAL_SPECIALIZATION 159 # define __STL_FUNCTION_TMPL_PARTIAL_ORDER 160 # define __STL_MEMBER_TEMPLATES 161 # define __STL_MEMBER_TEMPLATE_CLASSES 162 # define __STL_EXPLICIT_FUNCTION_TMPL_ARGS 163 # define __STL_HAS_NAMESPACES 164 # define __STL_NO_NAMESPACES 165 # define __SGI_STL_USE_AUTO_PTR_CONVERSIONS 166 # define __STL_USE_NAMESPACES 167 # endif 168 # if defined(__linux__) 169 /* glibc pre 2.0 is very buggy. We have to disable thread for it. 170 It should be upgraded to glibc 2.0 or later. */ 171 # if !defined(_NOTHREADS) && __GLIBC__ >= 2 && defined(_G_USING_THUNKS) 172 # define __STL_PTHREADS 173 # ifdef __STRICT_ANSI__ 174 /* Work around a bug in the glibc 2.0.x pthread.h. */ 175 # define sigset_t __sigset_t 176 # endif 177 # endif 178 # endif 179 # ifdef __EXCEPTIONS 180 # define __STL_USE_EXCEPTIONS 181 # endif 182 # ifndef __STRICT_ANSI__ 183 # define __STL_LONG_LONG 184 # endif 185 # endif 186 187 # if defined(__SUNPRO_CC) 188 # define __STL_NO_BOOL 189 # define __STL_NEED_TYPENAME 190 # define __STL_NEED_EXPLICIT 191 # define __STL_USE_EXCEPTIONS 192 # endif 193 194 # if defined(__COMO__) 195 # define __STL_MEMBER_TEMPLATES 196 # define __STL_MEMBER_TEMPLATE_CLASSES 197 # define __STL_CLASS_PARTIAL_SPECIALIZATION 198 # define __STL_USE_EXCEPTIONS 199 # define __STL_HAS_NAMESPACES 200 # endif 201 202 # if defined(__MINGW32__) 203 # define __STL_NO_DRAND48 204 # endif 205 206 # if defined(__CYGWIN__) 207 # define __STL_NO_DRAND48 208 # endif 209 210 # if defined(_MSC_VER) 211 # define __STL_NO_DRAND48 212 # define __STL_NEED_TYPENAME 213 # if _MSC_VER < 1100 /* 1000 is version 4.0, 1100 is 5.0, 1200 is 6.0. */ 214 # define __STL_NEED_EXPLICIT 215 # define __STL_NO_BOOL 216 # if _MSC_VER > 1000 217 # include <yvals.h> 218 # define __STL_DONT_USE_BOOL_TYPEDEF 219 # endif 220 # endif 221 # define __STL_NON_TYPE_TMPL_PARAM_BUG 222 # define __SGI_STL_NO_ARROW_OPERATOR 223 # ifdef _CPPUNWIND 224 # define __STL_USE_EXCEPTIONS 225 # endif 226 # ifdef _MT 227 # define __STL_WIN32THREADS 228 # endif 229 # if _MSC_VER >= 1200 230 # define __STL_PARTIAL_SPECIALIZATION_SYNTAX 231 # define __STL_HAS_NAMESPACES 232 # define __STL_NO_NAMESPACES 233 # endif 234 # endif 235 236 # if defined(__BORLANDC__) 237 # define __STL_NO_DRAND48 238 # define __STL_NEED_TYPENAME 239 # define __STL_LIMITED_DEFAULT_TEMPLATES 240 # define __SGI_STL_NO_ARROW_OPERATOR 241 # define __STL_NON_TYPE_TMPL_PARAM_BUG 242 # ifdef _CPPUNWIND 243 # define __STL_USE_EXCEPTIONS 244 # endif 245 # ifdef __MT__ 246 # define __STL_WIN32THREADS 247 # endif 248 # endif 249 250 # if defined(__STL_NO_BOOL) && !defined(__STL_DONT_USE_BOOL_TYPEDEF) 251 typedef int bool; 252 # define true 1 253 # define false 0 254 # endif 255 256 # ifdef __STL_NEED_TYPENAME 257 # define typename 258 # endif 259 260 # ifdef __STL_MEMBER_TEMPLATE_KEYWORD 261 # define __STL_TEMPLATE template 262 # else 263 # define __STL_TEMPLATE 264 # endif 265 266 # ifdef __STL_NEED_EXPLICIT 267 # define explicit 268 # endif 269 270 # ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS 271 # define __STL_NULL_TMPL_ARGS <> 272 # else 273 # define __STL_NULL_TMPL_ARGS 274 # endif 275 276 # if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) \ 277 || defined (__STL_PARTIAL_SPECIALIZATION_SYNTAX) 278 # define __STL_TEMPLATE_NULL template<> 279 # else 280 # define __STL_TEMPLATE_NULL 281 # endif 282 283 // Use standard-conforming allocators if we have the necessary language 284 // features. __STL_USE_SGI_ALLOCATORS is a hook so that users can 285 // disable new-style allocators, and continue to use the same kind of 286 // allocators as before, without having to edit library headers. 287 # if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && \ 288 defined(__STL_MEMBER_TEMPLATES) && \ 289 defined(__STL_MEMBER_TEMPLATE_CLASSES) && \ 290 !defined(__STL_NO_BOOL) && \ 291 !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) && \ 292 !defined(__STL_LIMITED_DEFAULT_TEMPLATES) && \ 293 !defined(__STL_USE_SGI_ALLOCATORS) || \ 294 defined(__BEOS__) 295 # define __STL_USE_STD_ALLOCATORS 296 # endif 297 298 # ifndef __STL_DEFAULT_ALLOCATOR 299 # ifdef __STL_USE_STD_ALLOCATORS 300 # define __STL_DEFAULT_ALLOCATOR(T) allocator<T> 301 # else 302 # define __STL_DEFAULT_ALLOCATOR(T) alloc 303 # endif 304 # endif 305 306 // __STL_NO_NAMESPACES is a hook so that users can disable namespaces 307 // without having to edit library headers. 308 # if defined(__STL_HAS_NAMESPACES) && !defined(__STL_NO_NAMESPACES) 309 # define __STD std 310 # define __STL_BEGIN_NAMESPACE namespace std { 311 # define __STL_END_NAMESPACE } 312 # define __STL_USE_NAMESPACE_FOR_RELOPS 313 # define __STL_BEGIN_RELOPS_NAMESPACE namespace std { 314 # define __STL_END_RELOPS_NAMESPACE } 315 # define __STD_RELOPS std 316 # define __STL_USE_NAMESPACES 317 # else 318 # define __STD 319 # define __STL_BEGIN_NAMESPACE 320 # define __STL_END_NAMESPACE 321 # undef __STL_USE_NAMESPACE_FOR_RELOPS 322 # define __STL_BEGIN_RELOPS_NAMESPACE 323 # define __STL_END_RELOPS_NAMESPACE 324 # define __STD_RELOPS 325 # undef __STL_USE_NAMESPACES 326 # endif 327 328 # ifdef __STL_USE_EXCEPTIONS 329 # define __STL_TRY try 330 # define __STL_CATCH_ALL catch(...) 331 # define __STL_THROW(x) throw x 332 # define __STL_RETHROW throw 333 # define __STL_NOTHROW throw() 334 # define __STL_UNWIND(action) catch(...) { action; throw; } 335 # else 336 # define __STL_TRY 337 # define __STL_CATCH_ALL if (false) 338 # define __STL_THROW(x) 339 # define __STL_RETHROW 340 # define __STL_NOTHROW 341 # define __STL_UNWIND(action) 342 # endif 343 344 #ifdef __STL_ASSERTIONS 345 # include <stdio.h> 346 # define __stl_assert(expr) \ 347 if (!(expr)) { fprintf(stderr, "%s:%d STL assertion failure: %s\n", \ 348 __FILE__, __LINE__, # expr); abort(); } 349 #else 350 # define __stl_assert(expr) 351 #endif 352 353 #endif /* __STL_CONFIG_H */ 354 355 // Local Variables: 356 // mode:C++ 357 // End: 358