components/stdcxx/patches/087-21.string.stdcxx-162.cpp.patch
changeset 402 94ae4d75524c
equal deleted inserted replaced
401:bf52ef48020c 402:94ae4d75524c
       
     1 --- stdcxx-4.2.1/tests/regress/21.string.stdcxx-162.cpp	2008-04-24 17:23:26.000000000 -0700
       
     2 +++ stdcxx-4.2.1/tests/regress/21.string.stdcxx-162.cpp	2011-03-23 11:45:44.381532276 -0700
       
     3 @@ -28,6 +28,7 @@
       
     4  
       
     5  #include <cassert>
       
     6  #include <string>
       
     7 +#include <iostream>
       
     8  
       
     9  #ifdef _RWSTD_POSIX_THREADS
       
    10  #  include <pthread.h>
       
    11 @@ -47,6 +48,14 @@
       
    12          int ref_count;
       
    13          std::string::size_type capacity;
       
    14          std::string::size_type size;
       
    15 +#ifndef _RWSTD_NO_STRING_REF_COUNT
       
    16 +#  if defined (_RWSTD_REENTRANT)            \
       
    17 +	&& !defined (_RWSTD_ONE_STRING_MUTEX)   \
       
    18 +	&& !defined (_RWSTD_NO_STRING_MUTEX)
       
    19 +
       
    20 +	__rw::__rw_mutex_base mutex;
       
    21 +#  endif   // _REENTRANT && !_ONE_STRING_MUTEX && !_NO_STRING_MUTEX
       
    22 +#endif // _RWSTD_NO_STRING_REF_COUNT
       
    23      };
       
    24  
       
    25      // verify that the reference-counted string body isn't bigger
       
    26 @@ -56,15 +65,22 @@
       
    27  #ifdef MUTEX
       
    28  
       
    29      struct LargeRef {
       
    30 -        MUTEX                  mutex;
       
    31          int                    ref_count;
       
    32          std::string::size_type capacity;
       
    33          std::string::size_type size;
       
    34 +#ifndef _RWSTD_NO_STRING_REF_COUNT
       
    35 +#  if defined (_RWSTD_REENTRANT)            \
       
    36 +	&& !defined (_RWSTD_ONE_STRING_MUTEX)   \
       
    37 +	&& !defined (_RWSTD_NO_STRING_MUTEX)
       
    38 +
       
    39 +	__rw::__rw_mutex_base mutex;
       
    40 +#  endif   // _REENTRANT && !_ONE_STRING_MUTEX && !_NO_STRING_MUTEX
       
    41 +#endif // _RWSTD_NO_STRING_REF_COUNT
       
    42      };
       
    43  
       
    44      // verify that the reference-counted string body is smaller
       
    45      // than the struct containing a full-blown mutex object above
       
    46 -    assert (sizeof (strref) < sizeof (LargeRef));
       
    47 +    assert (sizeof (strref) <= sizeof (LargeRef));
       
    48  
       
    49  #endif   // MUTEX
       
    50