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# define __USE_MALLOC 91 // BeOS used to trick the STL allocator (in stl_alloc.h) into falling back 92 // to malloc/free-allocation by setting MAX_BYTES to 0. 93 // By requesting to use those directly, we should get the same allocator, 94 // but will avoid the '... creates array of size 0'-warnings that are 95 // produced by 'gcc -strict' (for instance when building ICU). 96 // Alternatively, we could define _PTHREADS here and use the real STL 97 // allocator with posix threads enabled (however, this would have to be 98 // tested first, and most probably requires a rebuild of gcc2, too, 99 // in order to make sure that no code existing in libstdc++.r4.so is 100 // still using the old allocator). 101 102 103// Other macros defined by this file: 104 105// * bool, true, and false, if __STL_NO_BOOL is defined. 106// * typename, as a null macro if it's not already a keyword. 107// * explicit, as a null macro if it's not already a keyword. 108// * namespace-related macros (__STD, __STL_BEGIN_NAMESPACE, etc.) 109// * exception-related macros (__STL_TRY, __STL_UNWIND, etc.) 110// * __stl_assert, either as a test or as a null macro, depending on 111// whether or not __STL_ASSERTIONS is defined. 112 113#ifdef _PTHREADS 114# define __STL_PTHREADS 115#endif 116#ifdef _SOLTHREADS 117# define __STL_SOLTHREADS 118#endif 119 120# if defined(__sgi) && !defined(__GNUC__) 121# if !defined(_BOOL) 122# define __STL_NO_BOOL 123# endif 124# if defined(_WCHAR_T_IS_KEYWORD) 125# define __STL_HAS_WCHAR_T 126# endif 127# if !defined(_TYPENAME_IS_KEYWORD) 128# define __STL_NEED_TYPENAME 129# endif 130# ifdef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES 131# define __STL_CLASS_PARTIAL_SPECIALIZATION 132# endif 133# ifdef _MEMBER_TEMPLATES 134# define __STL_MEMBER_TEMPLATES 135# define __STL_MEMBER_TEMPLATE_CLASSES 136# endif 137# if defined(_MEMBER_TEMPLATE_KEYWORD) 138# define __STL_MEMBER_TEMPLATE_KEYWORD 139# endif 140# if (_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32 141# define __STL_MEMBER_TEMPLATE_KEYWORD 142# endif 143# if !defined(_EXPLICIT_IS_KEYWORD) 144# define __STL_NEED_EXPLICIT 145# endif 146# ifdef __EXCEPTIONS 147# define __STL_USE_EXCEPTIONS 148# endif 149# if (_COMPILER_VERSION >= 721) && defined(_NAMESPACES) 150# define __STL_HAS_NAMESPACES 151# endif 152# if (_COMPILER_VERSION < 721) 153# define __STL_NO_EXCEPTION_HEADER 154# endif 155# if !defined(_NOTHREADS) && !defined(__STL_PTHREADS) 156# define __STL_SGI_THREADS 157# endif 158# if defined(_LONGLONG) && defined(_SGIAPI) && _SGIAPI 159# define __STL_LONG_LONG 160# endif 161# endif 162 163# ifdef __GNUC__ 164# include <_G_config.h> 165# define __STL_HAS_WCHAR_T 166# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) 167# define __STL_STATIC_TEMPLATE_MEMBER_BUG 168# define __STL_NEED_TYPENAME 169# define __STL_NEED_EXPLICIT 170# else 171# define __STL_CLASS_PARTIAL_SPECIALIZATION 172# define __STL_FUNCTION_TMPL_PARTIAL_ORDER 173# define __STL_MEMBER_TEMPLATES 174# define __STL_MEMBER_TEMPLATE_CLASSES 175# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS 176# define __STL_HAS_NAMESPACES 177# define __STL_NO_NAMESPACES 178# define __SGI_STL_USE_AUTO_PTR_CONVERSIONS 179# define __STL_USE_NAMESPACES 180# endif 181# if defined(__linux__) 182 /* glibc pre 2.0 is very buggy. We have to disable thread for it. 183 It should be upgraded to glibc 2.0 or later. */ 184# if !defined(_NOTHREADS) && __GLIBC__ >= 2 && defined(_G_USING_THUNKS) 185# define __STL_PTHREADS 186# ifdef __STRICT_ANSI__ 187 /* Work around a bug in the glibc 2.0.x pthread.h. */ 188# define sigset_t __sigset_t 189# endif 190# endif 191# endif 192# ifdef __EXCEPTIONS 193# define __STL_USE_EXCEPTIONS 194# endif 195# ifndef __STRICT_ANSI__ 196# define __STL_LONG_LONG 197# endif 198# endif 199 200# if defined(__SUNPRO_CC) 201# define __STL_NO_BOOL 202# define __STL_NEED_TYPENAME 203# define __STL_NEED_EXPLICIT 204# define __STL_USE_EXCEPTIONS 205# endif 206 207# if defined(__COMO__) 208# define __STL_MEMBER_TEMPLATES 209# define __STL_MEMBER_TEMPLATE_CLASSES 210# define __STL_CLASS_PARTIAL_SPECIALIZATION 211# define __STL_USE_EXCEPTIONS 212# define __STL_HAS_NAMESPACES 213# endif 214 215# if defined(__MINGW32__) 216# define __STL_NO_DRAND48 217# endif 218 219# if defined(__CYGWIN__) 220# define __STL_NO_DRAND48 221# endif 222 223# if defined(_MSC_VER) 224# define __STL_NO_DRAND48 225# define __STL_NEED_TYPENAME 226# if _MSC_VER < 1100 /* 1000 is version 4.0, 1100 is 5.0, 1200 is 6.0. */ 227# define __STL_NEED_EXPLICIT 228# define __STL_NO_BOOL 229# if _MSC_VER > 1000 230# include <yvals.h> 231# define __STL_DONT_USE_BOOL_TYPEDEF 232# endif 233# endif 234# define __STL_NON_TYPE_TMPL_PARAM_BUG 235# define __SGI_STL_NO_ARROW_OPERATOR 236# ifdef _CPPUNWIND 237# define __STL_USE_EXCEPTIONS 238# endif 239# ifdef _MT 240# define __STL_WIN32THREADS 241# endif 242# if _MSC_VER >= 1200 243# define __STL_PARTIAL_SPECIALIZATION_SYNTAX 244# define __STL_HAS_NAMESPACES 245# define __STL_NO_NAMESPACES 246# endif 247# endif 248 249# if defined(__BORLANDC__) 250# define __STL_NO_DRAND48 251# define __STL_NEED_TYPENAME 252# define __STL_LIMITED_DEFAULT_TEMPLATES 253# define __SGI_STL_NO_ARROW_OPERATOR 254# define __STL_NON_TYPE_TMPL_PARAM_BUG 255# ifdef _CPPUNWIND 256# define __STL_USE_EXCEPTIONS 257# endif 258# ifdef __MT__ 259# define __STL_WIN32THREADS 260# endif 261# endif 262 263# if defined(__STL_NO_BOOL) && !defined(__STL_DONT_USE_BOOL_TYPEDEF) 264 typedef int bool; 265# define true 1 266# define false 0 267# endif 268 269# ifdef __STL_NEED_TYPENAME 270# define typename 271# endif 272 273# ifdef __STL_MEMBER_TEMPLATE_KEYWORD 274# define __STL_TEMPLATE template 275# else 276# define __STL_TEMPLATE 277# endif 278 279# ifdef __STL_NEED_EXPLICIT 280# define explicit 281# endif 282 283# ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS 284# define __STL_NULL_TMPL_ARGS <> 285# else 286# define __STL_NULL_TMPL_ARGS 287# endif 288 289# if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) \ 290 || defined (__STL_PARTIAL_SPECIALIZATION_SYNTAX) 291# define __STL_TEMPLATE_NULL template<> 292# else 293# define __STL_TEMPLATE_NULL 294# endif 295 296// Use standard-conforming allocators if we have the necessary language 297// features. __STL_USE_SGI_ALLOCATORS is a hook so that users can 298// disable new-style allocators, and continue to use the same kind of 299// allocators as before, without having to edit library headers. 300# if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && \ 301 defined(__STL_MEMBER_TEMPLATES) && \ 302 defined(__STL_MEMBER_TEMPLATE_CLASSES) && \ 303 !defined(__STL_NO_BOOL) && \ 304 !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) && \ 305 !defined(__STL_LIMITED_DEFAULT_TEMPLATES) && \ 306 !defined(__STL_USE_SGI_ALLOCATORS) || \ 307 (defined(__BEOS__) || defined(__HAIKU__)) 308# define __STL_USE_STD_ALLOCATORS 309# endif 310 311# ifndef __STL_DEFAULT_ALLOCATOR 312# ifdef __STL_USE_STD_ALLOCATORS 313# define __STL_DEFAULT_ALLOCATOR(T) allocator<T> 314# else 315# define __STL_DEFAULT_ALLOCATOR(T) alloc 316# endif 317# endif 318 319// __STL_NO_NAMESPACES is a hook so that users can disable namespaces 320// without having to edit library headers. 321# if defined(__STL_HAS_NAMESPACES) && !defined(__STL_NO_NAMESPACES) 322# define __STD std 323# define __STL_BEGIN_NAMESPACE namespace std { 324# define __STL_END_NAMESPACE } 325# define __STL_USE_NAMESPACE_FOR_RELOPS 326# define __STL_BEGIN_RELOPS_NAMESPACE namespace std { 327# define __STL_END_RELOPS_NAMESPACE } 328# define __STD_RELOPS std 329# define __STL_USE_NAMESPACES 330# else 331# define __STD 332# define __STL_BEGIN_NAMESPACE 333# define __STL_END_NAMESPACE 334# undef __STL_USE_NAMESPACE_FOR_RELOPS 335# define __STL_BEGIN_RELOPS_NAMESPACE 336# define __STL_END_RELOPS_NAMESPACE 337# define __STD_RELOPS 338# undef __STL_USE_NAMESPACES 339# endif 340 341# ifdef __STL_USE_EXCEPTIONS 342# define __STL_TRY try 343# define __STL_CATCH_ALL catch(...) 344# define __STL_THROW(x) throw x 345# define __STL_RETHROW throw 346# define __STL_NOTHROW throw() 347# define __STL_UNWIND(action) catch(...) { action; throw; } 348# else 349# define __STL_TRY 350# define __STL_CATCH_ALL if (false) 351# define __STL_THROW(x) 352# define __STL_RETHROW 353# define __STL_NOTHROW 354# define __STL_UNWIND(action) 355# endif 356 357#ifdef __STL_ASSERTIONS 358# include <stdio.h> 359# define __stl_assert(expr) \ 360 if (!(expr)) { fprintf(stderr, "%s:%d STL assertion failure: %s\n", \ 361 __FILE__, __LINE__, # expr); abort(); } 362#else 363# define __stl_assert(expr) 364#endif 365 366#endif /* __STL_CONFIG_H */ 367 368// Local Variables: 369// mode:C++ 370// End: 371