os/ossrv/genericopenlibs/cppstdlib/stl/test/eh/Prefix.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/***********************************************************************************
sl@0
     2
  Prefix.h
sl@0
     3
sl@0
     4
 * Copyright (c) 1997
sl@0
     5
 * Mark of the Unicorn, Inc.
sl@0
     6
 *
sl@0
     7
 * Permission to use, copy, modify, distribute and sell this software
sl@0
     8
 * and its documentation for any purpose is hereby granted without fee,
sl@0
     9
 * provided that the above copyright notice appear in all copies and
sl@0
    10
 * that both that copyright notice and this permission notice appear
sl@0
    11
 * in supporting documentation.  Mark of the Unicorn makes no
sl@0
    12
 * representations about the suitability of this software for any
sl@0
    13
 * purpose.  It is provided "as is" without express or implied warranty.
sl@0
    14
sl@0
    15
    SUMMARY: Configuration #defines for STL EH test suite
sl@0
    16
sl@0
    17
***********************************************************************************/
sl@0
    18
sl@0
    19
#ifndef INCLUDED_MOTU_Prefix
sl@0
    20
#define INCLUDED_MOTU_Prefix 1
sl@0
    21
sl@0
    22
// Gives much more thorough checking, but may slow the tests
sl@0
    23
// considerably if your malloc is slow.
sl@0
    24
#define TESTCLASS_DEEP_DATA 1
sl@0
    25
sl@0
    26
# ifndef NO_FAST_ALLOCATOR
sl@0
    27
// #  define NO_FAST_ALLOCATOR
sl@0
    28
# endif
sl@0
    29
sl@0
    30
// Define this to use the SGI STL. Undefine it to test a different installation
sl@0
    31
#ifndef EH_NO_SGI_STL
sl@0
    32
# define EH_USE_SGI_STL 1
sl@0
    33
#endif
sl@0
    34
sl@0
    35
#if EH_USE_SGI_STL
sl@0
    36
sl@0
    37
#define EH_ASSERT _STLP_ASSERT
sl@0
    38
sl@0
    39
#define _STLP_46_COMPATIBILITY
sl@0
    40
sl@0
    41
//=========================================================================
sl@0
    42
// SGI STL-specific #defines
sl@0
    43
//  These control the behavior of the test suite when used with the SGI
sl@0
    44
//  STL. They have no effect when testing other STL implementations.
sl@0
    45
//=========================================================================
sl@0
    46
sl@0
    47
// # define _STLP_USE_RAW_SGI_ALLOCATORS
sl@0
    48
#ifndef _STLP_USE_NEWALLOC
sl@0
    49
#  define _STLP_USE_NEWALLOC
sl@0
    50
#endif
sl@0
    51
sl@0
    52
#if 0 // !defined  (_STLP_NO_CUSTOM_IO) && ! defined (__BORLANDC__)
sl@0
    53
#  define _STLP_NO_CUSTOM_IO
sl@0
    54
#endif
sl@0
    55
sl@0
    56
// Just include something to get whatever configuration header we're using.
sl@0
    57
#include <utility>
sl@0
    58
sl@0
    59
#ifndef _STLP_CALL
sl@0
    60
#  define _STLP_CALL
sl@0
    61
#endif
sl@0
    62
sl@0
    63
#if defined(_STLP_USE_NAMESPACES)
sl@0
    64
#  define EH_USE_NAMESPACES _STLP_USE_NAMESPACES
sl@0
    65
#endif
sl@0
    66
sl@0
    67
#define EH_BEGIN_NAMESPACE _STLP_BEGIN_NAMESPACE
sl@0
    68
#define EH_END_NAMESPACE _STLP_END_NAMESPACE
sl@0
    69
sl@0
    70
#define EH_NEW_HEADERS 1
sl@0
    71
sl@0
    72
//#if defined (_STLP_USE_NEW_IOSTREAMS)
sl@0
    73
#define EH_NEW_IOSTREAMS 1
sl@0
    74
//#endif
sl@0
    75
sl@0
    76
#if !defined (_STLP_USE_EXCEPTIONS)
sl@0
    77
#  define EH_NO_EXCEPTIONS
sl@0
    78
#endif
sl@0
    79
sl@0
    80
#if defined (_STLP_TEMPLATE_PARAM_SUBTYPE_BUG)
sl@0
    81
#  define EH_TEMPLATE_PARAM_SUBTYPE_BUG _STLP_TEMPLATE_PARAM_SUBTYPE_BUG
sl@0
    82
#endif
sl@0
    83
sl@0
    84
#if defined(_STLP_MULTI_CONST_TEMPLATE_ARG_BUG)
sl@0
    85
#  define EH_MULTI_CONST_TEMPLATE_ARG_BUG _STLP_MULTI_CONST_TEMPLATE_ARG_BUG
sl@0
    86
#endif
sl@0
    87
sl@0
    88
#if defined (STLPORT)
sl@0
    89
#  define EH_STD STLPORT
sl@0
    90
#elif defined(__STD)
sl@0
    91
#  define EH_STD __STD
sl@0
    92
#endif
sl@0
    93
sl@0
    94
// we want to be portable here, so std:: won't work.
sl@0
    95
#if defined(STLPORT_CSTD)
sl@0
    96
#  define EH_CSTD STLPORT_CSTD
sl@0
    97
#else
sl@0
    98
#  define EH_CSTD std
sl@0
    99
#endif
sl@0
   100
sl@0
   101
#define EH_DISTANCE(a, b, result) EH_STD::distance(a, b, result)
sl@0
   102
sl@0
   103
#define EH_HASHED_CONTAINERS_IMPLEMENTED 1
sl@0
   104
#define EH_HASH_CONTAINERS_SUPPORT_RESIZE 1
sl@0
   105
#define EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION 1
sl@0
   106
#define EH_SLIST_IMPLEMENTED 1
sl@0
   107
#define EH_SELECT1ST_HINT __select1st_hint
sl@0
   108
// fbp : DEC cxx is unable to compile it for some reason
sl@0
   109
#if !(defined (__DECCXX)  || defined (__amigaos__) || \
sl@0
   110
      (defined (__GNUC__) && (__GNUC__ <= 2) && (__GNUC_MINOR__ < 8)))
sl@0
   111
#  define EH_ROPE_IMPLEMENTED 1
sl@0
   112
#endif
sl@0
   113
#define EH_STRING_IMPLEMENTED 1
sl@0
   114
// # define EH_BITSET_IMPLEMENTED 1
sl@0
   115
//# define EH_VALARRAY_IMPLEMENTED 1  - we have no tests yet for valarray
sl@0
   116
sl@0
   117
#define stl_destroy EH_STD::destroy
sl@0
   118
#include <memory>
sl@0
   119
sl@0
   120
template <class _Tp>
sl@0
   121
class /*_STLP_CLASS_DECLSPEC*/ EH_allocator;
sl@0
   122
sl@0
   123
template <class _Tp>
sl@0
   124
class /*_STLP_CLASS_DECLSPEC*/ EH_allocator {
sl@0
   125
public:
sl@0
   126
sl@0
   127
  typedef _Tp        value_type;
sl@0
   128
  typedef value_type *       pointer;
sl@0
   129
  typedef const _Tp* const_pointer;
sl@0
   130
  typedef _Tp&       reference;
sl@0
   131
  typedef const _Tp& const_reference;
sl@0
   132
  typedef EH_CSTD::size_t     size_type;
sl@0
   133
  typedef EH_CSTD::ptrdiff_t  difference_type;
sl@0
   134
# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
sl@0
   135
  template <class _Tp1> struct rebind {
sl@0
   136
    typedef EH_allocator<_Tp1> other;
sl@0
   137
  };
sl@0
   138
# endif
sl@0
   139
  EH_allocator() _STLP_NOTHROW {}
sl@0
   140
 # if defined (_STLP_MEMBER_TEMPLATES)
sl@0
   141
  template <class _Tp1> EH_allocator(const EH_allocator<_Tp1>&) _STLP_NOTHROW {}
sl@0
   142
 # endif
sl@0
   143
  EH_allocator(const EH_allocator<_Tp>&) _STLP_NOTHROW {}
sl@0
   144
  ~EH_allocator() _STLP_NOTHROW {}
sl@0
   145
  pointer address(reference __x) { return &__x; }
sl@0
   146
  const_pointer address(const_reference __x) const { return &__x; }
sl@0
   147
  // __n is permitted to be 0.  The C++ standard says nothing about what the return value is when __n == 0.
sl@0
   148
  _Tp* allocate(size_type __n, const void* = 0) const {
sl@0
   149
    return __n != 0 ? __REINTERPRET_CAST(value_type*,EH_STD::__new_alloc::allocate(__n * sizeof(value_type))) : 0;
sl@0
   150
  }
sl@0
   151
  // __p is permitted to be a null pointer, only if n==0.
sl@0
   152
  void deallocate(pointer __p, size_type __n) const {
sl@0
   153
    _STLP_ASSERT( (__p == 0) == (__n == 0) )
sl@0
   154
      if (__p != 0) EH_STD::__new_alloc::deallocate((void*)__p, __n * sizeof(value_type));
sl@0
   155
  }
sl@0
   156
  // backwards compatibility
sl@0
   157
  void deallocate(pointer __p) const {  if (__p != 0) EH_STD::__new_alloc::deallocate((void*)__p, sizeof(value_type)); }
sl@0
   158
  size_type max_size() const _STLP_NOTHROW  { return size_t(-1) / sizeof(value_type); }
sl@0
   159
  void construct(pointer __p, const _Tp& __val) const { stlport::construct(__p, __val); }
sl@0
   160
  void destroy(pointer __p) const { stlport::destroy(__p); }
sl@0
   161
};
sl@0
   162
sl@0
   163
template <class _T1> inline bool  _STLP_CALL operator==(const EH_allocator<_T1>&, const EH_allocator<_T1>&)  { return true; }
sl@0
   164
template <class _T1> inline bool  _STLP_CALL operator!=(const EH_allocator<_T1>&, const EH_allocator<_T1>&) { return false; }
sl@0
   165
sl@0
   166
_STLP_BEGIN_NAMESPACE
sl@0
   167
// If custom allocators are being used without member template classes support :
sl@0
   168
// user (on purpose) is forced to define rebind/get operations !!!
sl@0
   169
template <class _Tp1, class _Tp2>
sl@0
   170
inline EH_allocator<_Tp2>& _STLP_CALL
sl@0
   171
__stl_alloc_rebind(EH_allocator<_Tp1>& __a, const _Tp2*) {  return (EH_allocator<_Tp2>&)(__a); }
sl@0
   172
template <class _Tp1, class _Tp2>
sl@0
   173
inline EH_allocator<_Tp2> _STLP_CALL
sl@0
   174
__stl_alloc_create(const EH_allocator<_Tp1>&, const _Tp2*) { return EH_allocator<_Tp2>(); }
sl@0
   175
_STLP_END_NAMESPACE
sl@0
   176
sl@0
   177
# define eh_allocator(T) ::EH_allocator<T>
sl@0
   178
sl@0
   179
# define EH_BIT_VECTOR_IMPLEMENTED
sl@0
   180
sl@0
   181
# if defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined(_STLP_NO_BOOL)
sl@0
   182
#  define EH_BIT_VECTOR EH_STD::vector<bool, eh_allocator(bool) >
sl@0
   183
# else
sl@0
   184
#  ifdef _STLP_NO_BOOL
sl@0
   185
#  undef   EH_BIT_VECTOR_IMPLEMENTED
sl@0
   186
#  else
sl@0
   187
#   define EH_BIT_VECTOR EH_STD::vector<bool, eh_allocator(bool) >
sl@0
   188
#  endif
sl@0
   189
# endif
sl@0
   190
sl@0
   191
#else // !USE_SGI_STL
sl@0
   192
//=========================================================================
sl@0
   193
// Configuration for testing other non-SGI STL implementations
sl@0
   194
//=========================================================================
sl@0
   195
sl@0
   196
// Metrowerks configuration
sl@0
   197
# ifdef __MWERKS__
sl@0
   198
sl@0
   199
# define EH_ASSERT assert
sl@0
   200
// Get MSL configuration header
sl@0
   201
#  include <ansi_parms.h>
sl@0
   202
sl@0
   203
#  if __MSL__ >= 24
sl@0
   204
sl@0
   205
#   define EH_NEW_HEADERS 1
sl@0
   206
#   if defined (_MSL_USING_NAMESPACE)
sl@0
   207
#    define EH_USE_NAMESPACES 1
sl@0
   208
#   endif
sl@0
   209
#  define EH_BIT_VECTOR vector<bool>
sl@0
   210
#   define EH_DISTANCE( a, b, result ) do { result = distance( a, b ); } while (0)
sl@0
   211
sl@0
   212
#  else
sl@0
   213
sl@0
   214
#   error No configuration for earlier versions of MSL
sl@0
   215
sl@0
   216
#  endif  // __MSL__ >= 24
sl@0
   217
sl@0
   218
// Bugs fixed in CWPro3
sl@0
   219
#  if __MWERKS__ < 0x2100
sl@0
   220
#   define EH_TEMPLATE_PARAM_SUBTYPE_BUG 1
sl@0
   221
#  endif
sl@0
   222
sl@0
   223
// Bugs in CWPro3
sl@0
   224
#  if __MWERKS__ <= 0x2110
sl@0
   225
#   define EH_MULTI_CONST_TEMPLATE_ARG_BUG 1
sl@0
   226
#  else
sl@0
   227
#   pragma warning not sure the above bug is fixed yet
sl@0
   228
#  endif
sl@0
   229
sl@0
   230
#  define EH_SLIST_IMPLEMENTED 1
sl@0
   231
//#  define EH_HASHED_CONTAINERS_IMPLEMENTED 1
sl@0
   232
sl@0
   233
#  define EH_NEW_IOSTREAMS 1
sl@0
   234
#  define EH_USE_NOTHROW 1
sl@0
   235
# endif // Metrowerks configuration
sl@0
   236
sl@0
   237
#if defined (__SUNPRO_CC)
sl@0
   238
# define stl_destroy __RWSTD::__destroy
sl@0
   239
# define EH_DISTANCE( a, b, result ) distance( a, b, result )
sl@0
   240
# define EH_BIT_VECTOR EH_STD::vector<bool>
sl@0
   241
# define EH_NEW_HEADERS 1
sl@0
   242
# define EH_USE_NAMESPACES 1
sl@0
   243
# define EH_NEW_IOSTREAMS 1
sl@0
   244
# define EH_ASSERT assert
sl@0
   245
# define EH_STRING_IMPLEMENTED 1
sl@0
   246
# elif defined (__KCC)
sl@0
   247
# define stl_destroy EH_STD::destroy
sl@0
   248
# define EH_DISTANCE( a, b, result ) do { result = distance( a, b ); } while (0)
sl@0
   249
# define EH_BIT_VECTOR EH_STD::vector<bool>
sl@0
   250
# define EH_NEW_HEADERS 1
sl@0
   251
# define EH_USE_NAMESPACES 1
sl@0
   252
# define EH_NEW_IOSTREAMS 1
sl@0
   253
# define EH_ASSERT assert
sl@0
   254
# define EH_CSTD
sl@0
   255
# define EH_STRING_IMPLEMENTED 1
sl@0
   256
# define EH_MULTI_CONST_TEMPLATE_ARG_BUG 1
sl@0
   257
# define EH_SELECT1ST_HINT select1st
sl@0
   258
# else
sl@0
   259
# define stl_destroy destroy
sl@0
   260
#endif
sl@0
   261
sl@0
   262
//
sl@0
   263
// Compiler-independent configuration
sl@0
   264
//
sl@0
   265
# ifdef EH_USE_NAMESPACES
sl@0
   266
# ifdef STLPORT
sl@0
   267
#  define EH_STD STLPORT
sl@0
   268
# else
sl@0
   269
#  define EH_STD std
sl@0
   270
# endif
sl@0
   271
# ifdef STLPORT_CSTD
sl@0
   272
#  define EH_STD STLPORT_CSTD
sl@0
   273
# else
sl@0
   274
#  define EH_STD std
sl@0
   275
# endif
sl@0
   276
#  define EH_BEGIN_NAMESPACE namespace EH_STD {
sl@0
   277
#  define EH_END_NAMESPACE   }
sl@0
   278
# else
sl@0
   279
#  define EH_BEGIN_NAMESPACE
sl@0
   280
#  define EH_END_NAMESPACE
sl@0
   281
#  define EH_STD
sl@0
   282
# endif
sl@0
   283
sl@0
   284
# ifndef EH_CSTD
sl@0
   285
#  define EH_CSTD EH_STD
sl@0
   286
# endif
sl@0
   287
sl@0
   288
#endif // !USE_SGI_STL
sl@0
   289
sl@0
   290
sl@0
   291
//
sl@0
   292
// Library-independent configuration.
sl@0
   293
//
sl@0
   294
#if defined( EH_MULTI_CONST_TEMPLATE_ARG_BUG) && !defined( EH_SELECT1ST_HINT )
sl@0
   295
template <class Pair, class U>
sl@0
   296
// JDJ (CW Pro1 doesn't like const when first_type is also const)
sl@0
   297
struct eh_select1st_hint : public unary_function<Pair, U> {
sl@0
   298
    const U& operator () (const Pair& x) const { return x.first; }
sl@0
   299
};
sl@0
   300
# define EH_SELECT1ST_HINT eh_select1st_hint
sl@0
   301
#endif
sl@0
   302
sl@0
   303
sl@0
   304
#if EH_USE_NAMESPACES
sl@0
   305
# define EH_USE_STD using namespace EH_STD;
sl@0
   306
#else
sl@0
   307
# define EH_USE_STD
sl@0
   308
#endif
sl@0
   309
sl@0
   310
#if defined (EH_USE_NAMESPACES) && !defined(_STLP_VENDOR_GLOBAL_CSTD)
sl@0
   311
# define USING_CSTD_NAME(name) using EH_CSTD :: name;
sl@0
   312
#else
sl@0
   313
# define USING_CSTD_NAME(name)
sl@0
   314
#endif
sl@0
   315
sl@0
   316
#endif // INCLUDED_MOTU_Prefix