Author: faridz Date: Mon Oct 6 08:33:23 2008 New Revision: 702179 URL: http://svn.apache.org/viewvc?rev=702179&view=rev Log: 2008-10-06 Farid Zaripov <[EMAIL PROTECTED]>
* include/rw/_atomic-deccxx.h: #define corresponding _RWSTD_NO_XXX_ATOMIC_OPS macros for types, which are not supported in atomic operations. * include/rw/_atomic-mipspro.h: Ditto. * include/rw/_atomic-parisc.h: Ditto. * include/rw/_atomic-sparc.h: Ditto. * include/rw/_atomic-x86.h: Ditto. * include/rw/_atomic-xlc.h: Ditto. * include/rw/_atomic-x64.h: Ditto. Arrange 64-bit atomic functions into single #if/#endif block. * include/rw/_atomic-sync.h: Same. * include/rw/_atomic.h: Define generic bool, long and long long atomic functions only if the corresponding char/short/int/long atomic functions are defined. * include/rw/_mutex.h: Cleanup _RWSTD_NO_XXX_ATOMIC_OPS macros. (__rw_get_static_mutex): Check for presence of the int atomic operations instead of checking the PA RISC platform. Modified: stdcxx/branches/4.2.x/include/rw/_atomic-deccxx.h stdcxx/branches/4.2.x/include/rw/_atomic-mipspro.h stdcxx/branches/4.2.x/include/rw/_atomic-parisc.h stdcxx/branches/4.2.x/include/rw/_atomic-sparc.h stdcxx/branches/4.2.x/include/rw/_atomic-sync.h stdcxx/branches/4.2.x/include/rw/_atomic-x64.h stdcxx/branches/4.2.x/include/rw/_atomic-x86.h stdcxx/branches/4.2.x/include/rw/_atomic-xlc.h stdcxx/branches/4.2.x/include/rw/_atomic.h stdcxx/branches/4.2.x/include/rw/_mutex.h Modified: stdcxx/branches/4.2.x/include/rw/_atomic-deccxx.h URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_atomic-deccxx.h?rev=702179&r1=702178&r2=702179&view=diff ============================================================================== --- stdcxx/branches/4.2.x/include/rw/_atomic-deccxx.h (original) +++ stdcxx/branches/4.2.x/include/rw/_atomic-deccxx.h Mon Oct 6 08:33:23 2008 @@ -33,6 +33,10 @@ // get declarations of __ATOMIC_XXX intrinsics # include <machine/builtins.h> +#define _RWSTD_NO_CHAR_ATOMIC_OPS +#define _RWSTD_NO_SHORT_ATOMIC_OPS +#define _RWSTD_NO_LLONG_ATOMIC_OPS + _RWSTD_NAMESPACE (__rw) { // __ATOMIC_[DE|IN]CREMENT_[LONG|QUAD] and __ATOMIC_EXCH_[LONG|QUAD] are Modified: stdcxx/branches/4.2.x/include/rw/_atomic-mipspro.h URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_atomic-mipspro.h?rev=702179&r1=702178&r2=702179&view=diff ============================================================================== --- stdcxx/branches/4.2.x/include/rw/_atomic-mipspro.h (original) +++ stdcxx/branches/4.2.x/include/rw/_atomic-mipspro.h Mon Oct 6 08:33:23 2008 @@ -32,6 +32,10 @@ # include <mutex.h> +#define _RWSTD_NO_CHAR_ATOMIC_OPS +#define _RWSTD_NO_SHORT_ATOMIC_OPS +#define _RWSTD_NO_LLONG_ATOMIC_OPS + _RWSTD_NAMESPACE (__rw) { inline unsigned @@ -127,6 +131,8 @@ false); } +# else // _RWSTD_INT_SIZE == _RWSTD_LONG_SIZE +# define _RWSTD_NO_LONG_ATOMIC_OPS # endif // _RWSTD_INT_SIZE < _RWSTD_LONG_SIZE } // namespace __rw Modified: stdcxx/branches/4.2.x/include/rw/_atomic-parisc.h URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_atomic-parisc.h?rev=702179&r1=702178&r2=702179&view=diff ============================================================================== --- stdcxx/branches/4.2.x/include/rw/_atomic-parisc.h (original) +++ stdcxx/branches/4.2.x/include/rw/_atomic-parisc.h Mon Oct 6 08:33:23 2008 @@ -30,6 +30,12 @@ * **************************************************************************/ +#define _RWSTD_NO_CHAR_ATOMIC_OPS +#define _RWSTD_NO_SHORT_ATOMIC_OPS +#define _RWSTD_NO_INT_ATOMIC_OPS +#define _RWSTD_NO_LONG_ATOMIC_OPS +#define _RWSTD_NO_LLONG_ATOMIC_OPS + _RWSTD_NAMESPACE (__rw) { extern "C" { Modified: stdcxx/branches/4.2.x/include/rw/_atomic-sparc.h URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_atomic-sparc.h?rev=702179&r1=702178&r2=702179&view=diff ============================================================================== --- stdcxx/branches/4.2.x/include/rw/_atomic-sparc.h (original) +++ stdcxx/branches/4.2.x/include/rw/_atomic-sparc.h Mon Oct 6 08:33:23 2008 @@ -32,6 +32,10 @@ _RWSTD_NAMESPACE (__rw) { +#define _RWSTD_NO_CHAR_ATOMIC_OPS +#define _RWSTD_NO_SHORT_ATOMIC_OPS +#define _RWSTD_NO_LLONG_ATOMIC_OPS + extern "C" { // define in assembler file "atomic-sparc.s" and "atomic-sparc64.s" @@ -149,6 +153,8 @@ _RWSTD_STATIC_CAST (long, __y)); } +# else // _RWSTD_INT_SIZE == _RWSTD_LONG_SIZE +# define _RWSTD_NO_LONG_ATOMIC_OPS # endif // _RWSTD_INT_SIZE < _RWSTD_LONG_SIZE } // namespace __rw Modified: stdcxx/branches/4.2.x/include/rw/_atomic-sync.h URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_atomic-sync.h?rev=702179&r1=702178&r2=702179&view=diff ============================================================================== --- stdcxx/branches/4.2.x/include/rw/_atomic-sync.h (original) +++ stdcxx/branches/4.2.x/include/rw/_atomic-sync.h Mon Oct 6 08:33:23 2008 @@ -92,49 +92,6 @@ } -#if defined (__ia64) || defined (__x86_64) -# if 4 < _RWSTD_LONG_SIZE - -inline long -__rw_atomic_preincrement (long &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (long)); - return __sync_add_and_fetch (&__x, 1); -} - - -inline unsigned long -__rw_atomic_preincrement (unsigned long &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned long)); - return __sync_add_and_fetch (&__x, 1); -} - -# endif // _RWSTD_LONG_SIZE - - -# ifdef _RWSTD_LONG_LONG -# if _RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE - -inline _RWSTD_LONG_LONG -__rw_atomic_preincrement (_RWSTD_LONG_LONG &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (_RWSTD_LONG_LONG)); - return __sync_add_and_fetch (&__x, 1); -} - - -inline unsigned _RWSTD_LONG_LONG -__rw_atomic_preincrement (unsigned _RWSTD_LONG_LONG &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned _RWSTD_LONG_LONG)); - return __sync_add_and_fetch (&__x, 1); -} - -# endif // _RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE -# endif // _RWSTD_LONG_LONG -#endif // __ia64 || __x86_64 - inline char __rw_atomic_predecrement (char &__x, bool) { @@ -191,50 +148,6 @@ } -#if defined (__ia64) || defined (__x86_64) -# if 4 < _RWSTD_LONG_SIZE - -inline long -__rw_atomic_predecrement (long &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (long)); - return __sync_sub_and_fetch (&__x, 1); -} - - -inline unsigned long -__rw_atomic_predecrement (unsigned long &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned long)); - return __sync_sub_and_fetch (&__x, 1); -} - -# endif // _RWSTD_LONG_SIZE - - -# ifdef _RWSTD_LONG_LONG -# if _RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE - -inline _RWSTD_LONG_LONG -__rw_atomic_predecrement (_RWSTD_LONG_LONG &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (_RWSTD_LONG_LONG)); - return __sync_sub_and_fetch (&__x, 1); -} - - -inline unsigned _RWSTD_LONG_LONG -__rw_atomic_predecrement (unsigned _RWSTD_LONG_LONG &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned _RWSTD_LONG_LONG)); - return __sync_sub_and_fetch (&__x, 1); -} - -# endif // _RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE -# endif // _RWSTD_LONG_LONG -#endif // __ia64 || __x86_64 - - inline char __rw_atomic_exchange (char &__x, char __y, bool) { @@ -295,6 +208,38 @@ # if 4 < _RWSTD_LONG_SIZE inline long +__rw_atomic_preincrement (long &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (long)); + return __sync_add_and_fetch (&__x, 1); +} + + +inline unsigned long +__rw_atomic_preincrement (unsigned long &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned long)); + return __sync_add_and_fetch (&__x, 1); +} + + +inline long +__rw_atomic_predecrement (long &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (long)); + return __sync_sub_and_fetch (&__x, 1); +} + + +inline unsigned long +__rw_atomic_predecrement (unsigned long &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned long)); + return __sync_sub_and_fetch (&__x, 1); +} + + +inline long __rw_atomic_exchange (long &__x, long __y, bool) { _RWSTD_COMPILE_ASSERT (8 == sizeof (long)); @@ -309,11 +254,44 @@ return __sync_lock_test_and_set (&__x, __y); } -# endif // _RWSTD_LONG_SIZE == _RWSTD_INT_SIZE +# else +# define _RWSTD_NO_LONG_ATOMIC_OPS +# endif // 4 < _RWSTD_LONG_SIZE + + +# if defined (_RWSTD_LONG_LONG) && (_RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE) + +inline _RWSTD_LONG_LONG +__rw_atomic_preincrement (_RWSTD_LONG_LONG &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (_RWSTD_LONG_LONG)); + return __sync_add_and_fetch (&__x, 1); +} + +inline unsigned _RWSTD_LONG_LONG +__rw_atomic_preincrement (unsigned _RWSTD_LONG_LONG &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned _RWSTD_LONG_LONG)); + return __sync_add_and_fetch (&__x, 1); +} + + +inline _RWSTD_LONG_LONG +__rw_atomic_predecrement (_RWSTD_LONG_LONG &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (_RWSTD_LONG_LONG)); + return __sync_sub_and_fetch (&__x, 1); +} + + +inline unsigned _RWSTD_LONG_LONG +__rw_atomic_predecrement (unsigned _RWSTD_LONG_LONG &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned _RWSTD_LONG_LONG)); + return __sync_sub_and_fetch (&__x, 1); +} -# ifdef _RWSTD_LONG_LONG -# if _RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE inline _RWSTD_LONG_LONG __rw_atomic_exchange (_RWSTD_LONG_LONG &__x, _RWSTD_LONG_LONG __y, bool) @@ -331,8 +309,13 @@ return __sync_lock_test_and_set (&__x, __y); } -# endif // _RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE -# endif // _RWSTD_LONG_LONG +# else +# define _RWSTD_NO_LLONG_ATOMIC_OPS +# endif // _RWSTD_LONG_LONG && _RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE + +#else // !__ia64 && !__x86_64 +# define _RWSTD_NO_LONG_ATOMIC_OPS +# define _RWSTD_NO_LLONG_ATOMIC_OPS #endif // __ia64 || __x86_64 } // namespace __rw Modified: stdcxx/branches/4.2.x/include/rw/_atomic-x64.h URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_atomic-x64.h?rev=702179&r1=702178&r2=702179&view=diff ============================================================================== --- stdcxx/branches/4.2.x/include/rw/_atomic-x64.h (original) +++ stdcxx/branches/4.2.x/include/rw/_atomic-x64.h Mon Oct 6 08:33:23 2008 @@ -183,64 +183,6 @@ } -#if 4 < _RWSTD_LONG_SIZE - -inline long -__rw_atomic_preincrement (long &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (long)); - - return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), - +1); -} - - -inline unsigned long -__rw_atomic_preincrement (unsigned long &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned long)); - - return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), - +1); -} - -#endif // _RWSTD_LONG_SIZE - - -#ifdef _RWSTD_LONG_LONG -# if _RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE - -inline _RWSTD_LONG_LONG -__rw_atomic_preincrement (_RWSTD_LONG_LONG &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (_RWSTD_LONG_LONG)); - -#ifdef _MSC_VER - return _InterlockedIncrement64 (_RWSTD_REINTERPRET_CAST (__int64*, &__x)); -#else - return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), - +1); -#endif -} - - -inline unsigned _RWSTD_LONG_LONG -__rw_atomic_preincrement (unsigned _RWSTD_LONG_LONG &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned _RWSTD_LONG_LONG)); - -#ifdef _MSC_VER - return _InterlockedIncrement64 (_RWSTD_REINTERPRET_CAST (__int64*, &__x)); -#else - return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), - +1); -#endif -} - -# endif // _RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE -#endif // _RWSTD_LONG_LONG - - inline char __rw_atomic_predecrement (char &__x, bool) { @@ -327,64 +269,6 @@ } -#if 4 < _RWSTD_LONG_SIZE - -inline long -__rw_atomic_predecrement (long &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (long)); - - return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), - -1); -} - - -inline unsigned long -__rw_atomic_predecrement (unsigned long &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned long)); - - return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), - -1); -} - -#endif // _RWSTD_LONG_SIZE - - -#ifdef _RWSTD_LONG_LONG -# if _RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE - -inline _RWSTD_LONG_LONG -__rw_atomic_predecrement (_RWSTD_LONG_LONG &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (_RWSTD_LONG_LONG)); - -#ifdef _MSC_VER - return _InterlockedDecrement64 (_RWSTD_REINTERPRET_CAST (__int64*, &__x)); -#else - return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), - -1); -#endif -} - - -inline unsigned _RWSTD_LONG_LONG -__rw_atomic_predecrement (unsigned _RWSTD_LONG_LONG &__x, bool) -{ - _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned _RWSTD_LONG_LONG)); - -#ifdef _MSC_VER - return _InterlockedDecrement64 (_RWSTD_REINTERPRET_CAST (__int64*, &__x)); -#else - return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), - -1); -#endif -} - -# endif // _RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE -#endif // _RWSTD_LONG_LONG - - inline char __rw_atomic_exchange (char &__x, char __y, bool) { @@ -465,7 +349,47 @@ } -# if 4 < _RWSTD_LONG_SIZE +#if 4 < _RWSTD_LONG_SIZE + +inline long +__rw_atomic_preincrement (long &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (long)); + + return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), + +1); +} + + +inline unsigned long +__rw_atomic_preincrement (unsigned long &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned long)); + + return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), + +1); +} + + +inline long +__rw_atomic_predecrement (long &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (long)); + + return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), + -1); +} + + +inline unsigned long +__rw_atomic_predecrement (unsigned long &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned long)); + + return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), + -1); +} + inline long __rw_atomic_exchange (long &__x, long __y, bool) @@ -486,11 +410,68 @@ _RWSTD_STATIC_CAST (_RWSTD_INT64_T, __y)); } -# endif // _RWSTD_LONG_SIZE == _RWSTD_INT_SIZE +#else +# define _RWSTD_NO_LONG_ATOMIC_OPS +#endif // 4 < _RWSTD_LONG_SIZE + + +#if defined (_RWSTD_LONG_LONG) && (_RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE) + +inline _RWSTD_LONG_LONG +__rw_atomic_preincrement (_RWSTD_LONG_LONG &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (_RWSTD_LONG_LONG)); + +#ifdef _MSC_VER + return _InterlockedIncrement64 (_RWSTD_REINTERPRET_CAST (__int64*, &__x)); +#else + return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), + +1); +#endif +} + + +inline unsigned _RWSTD_LONG_LONG +__rw_atomic_preincrement (unsigned _RWSTD_LONG_LONG &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned _RWSTD_LONG_LONG)); +#ifdef _MSC_VER + return _InterlockedIncrement64 (_RWSTD_REINTERPRET_CAST (__int64*, &__x)); +#else + return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), + +1); +#endif +} + + +inline _RWSTD_LONG_LONG +__rw_atomic_predecrement (_RWSTD_LONG_LONG &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (_RWSTD_LONG_LONG)); + +#ifdef _MSC_VER + return _InterlockedDecrement64 (_RWSTD_REINTERPRET_CAST (__int64*, &__x)); +#else + return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), + -1); +#endif +} + + +inline unsigned _RWSTD_LONG_LONG +__rw_atomic_predecrement (unsigned _RWSTD_LONG_LONG &__x, bool) +{ + _RWSTD_COMPILE_ASSERT (8 == sizeof (unsigned _RWSTD_LONG_LONG)); + +#ifdef _MSC_VER + return _InterlockedDecrement64 (_RWSTD_REINTERPRET_CAST (__int64*, &__x)); +#else + return __rw_atomic_add64 (_RWSTD_REINTERPRET_CAST (_RWSTD_INT64_T*, &__x), + -1); +#endif +} -#ifdef _RWSTD_LONG_LONG -# if _RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE inline _RWSTD_LONG_LONG __rw_atomic_exchange (_RWSTD_LONG_LONG &__x, _RWSTD_LONG_LONG __y, bool) @@ -522,7 +503,8 @@ #endif } -# endif // _RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE -#endif // _RWSTD_LONG_LONG +#else +# define _RWSTD_NO_LLONG_ATOMIC_OPS +#endif // _RWSTD_LONG_LONG && _RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE } // namespace __rw Modified: stdcxx/branches/4.2.x/include/rw/_atomic-x86.h URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_atomic-x86.h?rev=702179&r1=702178&r2=702179&view=diff ============================================================================== --- stdcxx/branches/4.2.x/include/rw/_atomic-x86.h (original) +++ stdcxx/branches/4.2.x/include/rw/_atomic-x86.h Mon Oct 6 08:33:23 2008 @@ -30,6 +30,9 @@ * **************************************************************************/ +#define _RWSTD_NO_LONG_ATOMIC_OPS +#define _RWSTD_NO_LLONG_ATOMIC_OPS + #ifdef _MSC_VER extern "C" long __cdecl _InterlockedIncrement (volatile long*); Modified: stdcxx/branches/4.2.x/include/rw/_atomic-xlc.h URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_atomic-xlc.h?rev=702179&r1=702178&r2=702179&view=diff ============================================================================== --- stdcxx/branches/4.2.x/include/rw/_atomic-xlc.h (original) +++ stdcxx/branches/4.2.x/include/rw/_atomic-xlc.h Mon Oct 6 08:33:23 2008 @@ -32,6 +32,10 @@ #include <sys/atomic_op.h> +#define _RWSTD_NO_CHAR_ATOMIC_OPS +#define _RWSTD_NO_SHORT_ATOMIC_OPS +#define _RWSTD_NO_LLONG_ATOMIC_OPS + _RWSTD_NAMESPACE (__rw) { inline int @@ -137,6 +141,8 @@ _RWSTD_STATIC_CAST (long, __y), false); } +# else // _RWSTD_INT_SIZE == _RWSTD_LONG_SIZE +# define _RWSTD_NO_LONG_ATOMIC_OPS # endif // _RWSTD_INT_SIZE < _RWSTD_LONG_SIZE } // namespace __rw Modified: stdcxx/branches/4.2.x/include/rw/_atomic.h URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_atomic.h?rev=702179&r1=702178&r2=702179&view=diff ============================================================================== --- stdcxx/branches/4.2.x/include/rw/_atomic.h (original) +++ stdcxx/branches/4.2.x/include/rw/_atomic.h Mon Oct 6 08:33:23 2008 @@ -76,11 +76,14 @@ # ifndef _RWSTD_NO_BOOL -# if _RWSTD_BOOL_SIZE == _RWSTD_CHAR_SIZE +# if _RWSTD_BOOL_SIZE == _RWSTD_CHAR_SIZE \ + && !defined (_RWSTD_NO_CHAR_ATOMIC_OPS) # define _RWSTD_BOOL_TYPE char -# elif _RWSTD_BOOL_SIZE == _RWSTD_SHORT_SIZE +# elif _RWSTD_BOOL_SIZE == _RWSTD_SHORT_SIZE \ + && !defined (_RWSTD_NO_SHORT_ATOMIC_OPS) # define _RWSTD_BOOL_TYPE short -# elif _RWSTD_BOOL_SIZE == _RWSTD_INT_SIZE +# elif _RWSTD_BOOL_SIZE == _RWSTD_INT_SIZE \ + && !defined (_RWSTD_NO_INT_ATOMIC_OPS) # define _RWSTD_BOOL_TYPE int # endif @@ -107,7 +110,11 @@ /********************** generic long functions ************************/ -# if _RWSTD_LONG_SIZE == _RWSTD_INT_SIZE +# if _RWSTD_LONG_SIZE == _RWSTD_INT_SIZE \ + && defined (_RWSTD_NO_LONG_ATOMIC_OPS) \ + && !defined (_RWSTD_NO_INT_ATOMIC_OPS) + +# undef _RWSTD_NO_LONG_ATOMIC_OPS # if 6 == _RWSTD_HP_aCC_MAJOR // suppress HP aCC 64 bit migration remark: conversion from @@ -174,8 +181,12 @@ /********************** generic long long functions *******************/ -# ifdef _RWSTD_LONG_LONG -# if _RWSTD_LLONG_SIZE == _RWSTD_LONG_SIZE +# if defined (_RWSTD_LONG_LONG) \ + && _RWSTD_LLONG_SIZE == _RWSTD_LONG_SIZE \ + && defined (_RWSTD_NO_LLONG_ATOMIC_OPS) \ + && !defined (_RWSTD_NO_LONG_ATOMIC_OPS) + +# undef _RWSTD_NO_LLONG_ATOMIC_OPS _RWSTD_NAMESPACE (__rw) { @@ -226,8 +237,7 @@ } // namespace __rw -# endif // _RWSTD_LLONG_SIZE == _RWSTD_LONG_SIZE -# endif // _RWSTD_LONG_LONG +# endif // _RWSTD_LONG_LONG && _RWSTD_LLONG_SIZE == _RWSTD_LONG_SIZE # endif // _RWSTD_NO_ATOMIC_OPS Modified: stdcxx/branches/4.2.x/include/rw/_mutex.h URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_mutex.h?rev=702179&r1=702178&r2=702179&view=diff ============================================================================== --- stdcxx/branches/4.2.x/include/rw/_mutex.h (original) +++ stdcxx/branches/4.2.x/include/rw/_mutex.h Mon Oct 6 08:33:23 2008 @@ -295,16 +295,16 @@ // up with multiple copies) static volatile int __cntr /* = 0 */; // initialization counter -# if !defined (_RWSTD_NO_ATOMIC_OPS) && !defined (_PA_RISC2_0) +# if !defined (_RWSTD_NO_ATOMIC_OPS) && !defined (_RWSTD_NO_INT_ATOMIC_OPS) // MT safe // cast __cntr to int& (see STDCXX-792) // casting should be removed after fixing STDCXX-794 if (0 == __cntr && 1 == _RWSTD_ATOMIC_PREINCREMENT ( _RWSTD_CONST_CAST (int&, __cntr), false)) -# else +# else // _RWSTD_NO_ATOMIC_OPS || _RWSTD_NO_INT_ATOMIC_OPS // not so safe (volatile should help) if (0 == __cntr && 1 == ++__cntr) -# endif // _RWSTD_NO_ATOMIC_OPS +# endif // !_RWSTD_NO_ATOMIC_OPS && !_RWSTD_NO_INT_ATOMIC_OPS { // manually initialize `mutex' via a call to placement new @@ -445,4 +445,25 @@ #endif // _RWSTD_REENTRANT +// clean up +#ifdef _RWSTD_NO_CHAR_ATOMIC_OPS +# undef _RWSTD_NO_CHAR_ATOMIC_OPS +#endif + +#ifdef _RWSTD_NO_SHORT_ATOMIC_OPS +# undef _RWSTD_NO_SHORT_ATOMIC_OPS +#endif + +#ifdef _RWSTD_NO_INT_ATOMIC_OPS +# undef _RWSTD_NO_INT_ATOMIC_OPS +#endif + +#ifdef _RWSTD_NO_LONG_ATOMIC_OPS +# undef _RWSTD_NO_LONG_ATOMIC_OPS +#endif + +#ifdef _RWSTD_NO_LLONG_ATOMIC_OPS +# undef _RWSTD_NO_LLONG_ATOMIC_OPS +#endif + #endif // _RWSTD_RW_MUTEX_H_INCLUDED