1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/cppstdlib/stl/test/eh/Prefix.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,316 @@
1.4 +/***********************************************************************************
1.5 + Prefix.h
1.6 +
1.7 + * Copyright (c) 1997
1.8 + * Mark of the Unicorn, Inc.
1.9 + *
1.10 + * Permission to use, copy, modify, distribute and sell this software
1.11 + * and its documentation for any purpose is hereby granted without fee,
1.12 + * provided that the above copyright notice appear in all copies and
1.13 + * that both that copyright notice and this permission notice appear
1.14 + * in supporting documentation. Mark of the Unicorn makes no
1.15 + * representations about the suitability of this software for any
1.16 + * purpose. It is provided "as is" without express or implied warranty.
1.17 +
1.18 + SUMMARY: Configuration #defines for STL EH test suite
1.19 +
1.20 +***********************************************************************************/
1.21 +
1.22 +#ifndef INCLUDED_MOTU_Prefix
1.23 +#define INCLUDED_MOTU_Prefix 1
1.24 +
1.25 +// Gives much more thorough checking, but may slow the tests
1.26 +// considerably if your malloc is slow.
1.27 +#define TESTCLASS_DEEP_DATA 1
1.28 +
1.29 +# ifndef NO_FAST_ALLOCATOR
1.30 +// # define NO_FAST_ALLOCATOR
1.31 +# endif
1.32 +
1.33 +// Define this to use the SGI STL. Undefine it to test a different installation
1.34 +#ifndef EH_NO_SGI_STL
1.35 +# define EH_USE_SGI_STL 1
1.36 +#endif
1.37 +
1.38 +#if EH_USE_SGI_STL
1.39 +
1.40 +#define EH_ASSERT _STLP_ASSERT
1.41 +
1.42 +#define _STLP_46_COMPATIBILITY
1.43 +
1.44 +//=========================================================================
1.45 +// SGI STL-specific #defines
1.46 +// These control the behavior of the test suite when used with the SGI
1.47 +// STL. They have no effect when testing other STL implementations.
1.48 +//=========================================================================
1.49 +
1.50 +// # define _STLP_USE_RAW_SGI_ALLOCATORS
1.51 +#ifndef _STLP_USE_NEWALLOC
1.52 +# define _STLP_USE_NEWALLOC
1.53 +#endif
1.54 +
1.55 +#if 0 // !defined (_STLP_NO_CUSTOM_IO) && ! defined (__BORLANDC__)
1.56 +# define _STLP_NO_CUSTOM_IO
1.57 +#endif
1.58 +
1.59 +// Just include something to get whatever configuration header we're using.
1.60 +#include <utility>
1.61 +
1.62 +#ifndef _STLP_CALL
1.63 +# define _STLP_CALL
1.64 +#endif
1.65 +
1.66 +#if defined(_STLP_USE_NAMESPACES)
1.67 +# define EH_USE_NAMESPACES _STLP_USE_NAMESPACES
1.68 +#endif
1.69 +
1.70 +#define EH_BEGIN_NAMESPACE _STLP_BEGIN_NAMESPACE
1.71 +#define EH_END_NAMESPACE _STLP_END_NAMESPACE
1.72 +
1.73 +#define EH_NEW_HEADERS 1
1.74 +
1.75 +//#if defined (_STLP_USE_NEW_IOSTREAMS)
1.76 +#define EH_NEW_IOSTREAMS 1
1.77 +//#endif
1.78 +
1.79 +#if !defined (_STLP_USE_EXCEPTIONS)
1.80 +# define EH_NO_EXCEPTIONS
1.81 +#endif
1.82 +
1.83 +#if defined (_STLP_TEMPLATE_PARAM_SUBTYPE_BUG)
1.84 +# define EH_TEMPLATE_PARAM_SUBTYPE_BUG _STLP_TEMPLATE_PARAM_SUBTYPE_BUG
1.85 +#endif
1.86 +
1.87 +#if defined(_STLP_MULTI_CONST_TEMPLATE_ARG_BUG)
1.88 +# define EH_MULTI_CONST_TEMPLATE_ARG_BUG _STLP_MULTI_CONST_TEMPLATE_ARG_BUG
1.89 +#endif
1.90 +
1.91 +#if defined (STLPORT)
1.92 +# define EH_STD STLPORT
1.93 +#elif defined(__STD)
1.94 +# define EH_STD __STD
1.95 +#endif
1.96 +
1.97 +// we want to be portable here, so std:: won't work.
1.98 +#if defined(STLPORT_CSTD)
1.99 +# define EH_CSTD STLPORT_CSTD
1.100 +#else
1.101 +# define EH_CSTD std
1.102 +#endif
1.103 +
1.104 +#define EH_DISTANCE(a, b, result) EH_STD::distance(a, b, result)
1.105 +
1.106 +#define EH_HASHED_CONTAINERS_IMPLEMENTED 1
1.107 +#define EH_HASH_CONTAINERS_SUPPORT_RESIZE 1
1.108 +#define EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION 1
1.109 +#define EH_SLIST_IMPLEMENTED 1
1.110 +#define EH_SELECT1ST_HINT __select1st_hint
1.111 +// fbp : DEC cxx is unable to compile it for some reason
1.112 +#if !(defined (__DECCXX) || defined (__amigaos__) || \
1.113 + (defined (__GNUC__) && (__GNUC__ <= 2) && (__GNUC_MINOR__ < 8)))
1.114 +# define EH_ROPE_IMPLEMENTED 1
1.115 +#endif
1.116 +#define EH_STRING_IMPLEMENTED 1
1.117 +// # define EH_BITSET_IMPLEMENTED 1
1.118 +//# define EH_VALARRAY_IMPLEMENTED 1 - we have no tests yet for valarray
1.119 +
1.120 +#define stl_destroy EH_STD::destroy
1.121 +#include <memory>
1.122 +
1.123 +template <class _Tp>
1.124 +class /*_STLP_CLASS_DECLSPEC*/ EH_allocator;
1.125 +
1.126 +template <class _Tp>
1.127 +class /*_STLP_CLASS_DECLSPEC*/ EH_allocator {
1.128 +public:
1.129 +
1.130 + typedef _Tp value_type;
1.131 + typedef value_type * pointer;
1.132 + typedef const _Tp* const_pointer;
1.133 + typedef _Tp& reference;
1.134 + typedef const _Tp& const_reference;
1.135 + typedef EH_CSTD::size_t size_type;
1.136 + typedef EH_CSTD::ptrdiff_t difference_type;
1.137 +# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
1.138 + template <class _Tp1> struct rebind {
1.139 + typedef EH_allocator<_Tp1> other;
1.140 + };
1.141 +# endif
1.142 + EH_allocator() _STLP_NOTHROW {}
1.143 + # if defined (_STLP_MEMBER_TEMPLATES)
1.144 + template <class _Tp1> EH_allocator(const EH_allocator<_Tp1>&) _STLP_NOTHROW {}
1.145 + # endif
1.146 + EH_allocator(const EH_allocator<_Tp>&) _STLP_NOTHROW {}
1.147 + ~EH_allocator() _STLP_NOTHROW {}
1.148 + pointer address(reference __x) { return &__x; }
1.149 + const_pointer address(const_reference __x) const { return &__x; }
1.150 + // __n is permitted to be 0. The C++ standard says nothing about what the return value is when __n == 0.
1.151 + _Tp* allocate(size_type __n, const void* = 0) const {
1.152 + return __n != 0 ? __REINTERPRET_CAST(value_type*,EH_STD::__new_alloc::allocate(__n * sizeof(value_type))) : 0;
1.153 + }
1.154 + // __p is permitted to be a null pointer, only if n==0.
1.155 + void deallocate(pointer __p, size_type __n) const {
1.156 + _STLP_ASSERT( (__p == 0) == (__n == 0) )
1.157 + if (__p != 0) EH_STD::__new_alloc::deallocate((void*)__p, __n * sizeof(value_type));
1.158 + }
1.159 + // backwards compatibility
1.160 + void deallocate(pointer __p) const { if (__p != 0) EH_STD::__new_alloc::deallocate((void*)__p, sizeof(value_type)); }
1.161 + size_type max_size() const _STLP_NOTHROW { return size_t(-1) / sizeof(value_type); }
1.162 + void construct(pointer __p, const _Tp& __val) const { stlport::construct(__p, __val); }
1.163 + void destroy(pointer __p) const { stlport::destroy(__p); }
1.164 +};
1.165 +
1.166 +template <class _T1> inline bool _STLP_CALL operator==(const EH_allocator<_T1>&, const EH_allocator<_T1>&) { return true; }
1.167 +template <class _T1> inline bool _STLP_CALL operator!=(const EH_allocator<_T1>&, const EH_allocator<_T1>&) { return false; }
1.168 +
1.169 +_STLP_BEGIN_NAMESPACE
1.170 +// If custom allocators are being used without member template classes support :
1.171 +// user (on purpose) is forced to define rebind/get operations !!!
1.172 +template <class _Tp1, class _Tp2>
1.173 +inline EH_allocator<_Tp2>& _STLP_CALL
1.174 +__stl_alloc_rebind(EH_allocator<_Tp1>& __a, const _Tp2*) { return (EH_allocator<_Tp2>&)(__a); }
1.175 +template <class _Tp1, class _Tp2>
1.176 +inline EH_allocator<_Tp2> _STLP_CALL
1.177 +__stl_alloc_create(const EH_allocator<_Tp1>&, const _Tp2*) { return EH_allocator<_Tp2>(); }
1.178 +_STLP_END_NAMESPACE
1.179 +
1.180 +# define eh_allocator(T) ::EH_allocator<T>
1.181 +
1.182 +# define EH_BIT_VECTOR_IMPLEMENTED
1.183 +
1.184 +# if defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined(_STLP_NO_BOOL)
1.185 +# define EH_BIT_VECTOR EH_STD::vector<bool, eh_allocator(bool) >
1.186 +# else
1.187 +# ifdef _STLP_NO_BOOL
1.188 +# undef EH_BIT_VECTOR_IMPLEMENTED
1.189 +# else
1.190 +# define EH_BIT_VECTOR EH_STD::vector<bool, eh_allocator(bool) >
1.191 +# endif
1.192 +# endif
1.193 +
1.194 +#else // !USE_SGI_STL
1.195 +//=========================================================================
1.196 +// Configuration for testing other non-SGI STL implementations
1.197 +//=========================================================================
1.198 +
1.199 +// Metrowerks configuration
1.200 +# ifdef __MWERKS__
1.201 +
1.202 +# define EH_ASSERT assert
1.203 +// Get MSL configuration header
1.204 +# include <ansi_parms.h>
1.205 +
1.206 +# if __MSL__ >= 24
1.207 +
1.208 +# define EH_NEW_HEADERS 1
1.209 +# if defined (_MSL_USING_NAMESPACE)
1.210 +# define EH_USE_NAMESPACES 1
1.211 +# endif
1.212 +# define EH_BIT_VECTOR vector<bool>
1.213 +# define EH_DISTANCE( a, b, result ) do { result = distance( a, b ); } while (0)
1.214 +
1.215 +# else
1.216 +
1.217 +# error No configuration for earlier versions of MSL
1.218 +
1.219 +# endif // __MSL__ >= 24
1.220 +
1.221 +// Bugs fixed in CWPro3
1.222 +# if __MWERKS__ < 0x2100
1.223 +# define EH_TEMPLATE_PARAM_SUBTYPE_BUG 1
1.224 +# endif
1.225 +
1.226 +// Bugs in CWPro3
1.227 +# if __MWERKS__ <= 0x2110
1.228 +# define EH_MULTI_CONST_TEMPLATE_ARG_BUG 1
1.229 +# else
1.230 +# pragma warning not sure the above bug is fixed yet
1.231 +# endif
1.232 +
1.233 +# define EH_SLIST_IMPLEMENTED 1
1.234 +//# define EH_HASHED_CONTAINERS_IMPLEMENTED 1
1.235 +
1.236 +# define EH_NEW_IOSTREAMS 1
1.237 +# define EH_USE_NOTHROW 1
1.238 +# endif // Metrowerks configuration
1.239 +
1.240 +#if defined (__SUNPRO_CC)
1.241 +# define stl_destroy __RWSTD::__destroy
1.242 +# define EH_DISTANCE( a, b, result ) distance( a, b, result )
1.243 +# define EH_BIT_VECTOR EH_STD::vector<bool>
1.244 +# define EH_NEW_HEADERS 1
1.245 +# define EH_USE_NAMESPACES 1
1.246 +# define EH_NEW_IOSTREAMS 1
1.247 +# define EH_ASSERT assert
1.248 +# define EH_STRING_IMPLEMENTED 1
1.249 +# elif defined (__KCC)
1.250 +# define stl_destroy EH_STD::destroy
1.251 +# define EH_DISTANCE( a, b, result ) do { result = distance( a, b ); } while (0)
1.252 +# define EH_BIT_VECTOR EH_STD::vector<bool>
1.253 +# define EH_NEW_HEADERS 1
1.254 +# define EH_USE_NAMESPACES 1
1.255 +# define EH_NEW_IOSTREAMS 1
1.256 +# define EH_ASSERT assert
1.257 +# define EH_CSTD
1.258 +# define EH_STRING_IMPLEMENTED 1
1.259 +# define EH_MULTI_CONST_TEMPLATE_ARG_BUG 1
1.260 +# define EH_SELECT1ST_HINT select1st
1.261 +# else
1.262 +# define stl_destroy destroy
1.263 +#endif
1.264 +
1.265 +//
1.266 +// Compiler-independent configuration
1.267 +//
1.268 +# ifdef EH_USE_NAMESPACES
1.269 +# ifdef STLPORT
1.270 +# define EH_STD STLPORT
1.271 +# else
1.272 +# define EH_STD std
1.273 +# endif
1.274 +# ifdef STLPORT_CSTD
1.275 +# define EH_STD STLPORT_CSTD
1.276 +# else
1.277 +# define EH_STD std
1.278 +# endif
1.279 +# define EH_BEGIN_NAMESPACE namespace EH_STD {
1.280 +# define EH_END_NAMESPACE }
1.281 +# else
1.282 +# define EH_BEGIN_NAMESPACE
1.283 +# define EH_END_NAMESPACE
1.284 +# define EH_STD
1.285 +# endif
1.286 +
1.287 +# ifndef EH_CSTD
1.288 +# define EH_CSTD EH_STD
1.289 +# endif
1.290 +
1.291 +#endif // !USE_SGI_STL
1.292 +
1.293 +
1.294 +//
1.295 +// Library-independent configuration.
1.296 +//
1.297 +#if defined( EH_MULTI_CONST_TEMPLATE_ARG_BUG) && !defined( EH_SELECT1ST_HINT )
1.298 +template <class Pair, class U>
1.299 +// JDJ (CW Pro1 doesn't like const when first_type is also const)
1.300 +struct eh_select1st_hint : public unary_function<Pair, U> {
1.301 + const U& operator () (const Pair& x) const { return x.first; }
1.302 +};
1.303 +# define EH_SELECT1ST_HINT eh_select1st_hint
1.304 +#endif
1.305 +
1.306 +
1.307 +#if EH_USE_NAMESPACES
1.308 +# define EH_USE_STD using namespace EH_STD;
1.309 +#else
1.310 +# define EH_USE_STD
1.311 +#endif
1.312 +
1.313 +#if defined (EH_USE_NAMESPACES) && !defined(_STLP_VENDOR_GLOBAL_CSTD)
1.314 +# define USING_CSTD_NAME(name) using EH_CSTD :: name;
1.315 +#else
1.316 +# define USING_CSTD_NAME(name)
1.317 +#endif
1.318 +
1.319 +#endif // INCLUDED_MOTU_Prefix