incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov" <Farid_Zari...@epam.com>
Subject [PATCH] atomic ops on _PA_RISC2_0
Date Tue, 18 Mar 2008 18:55:56 GMT
  Why if _PA_RISC2_0 macro is defined the atimic functions are named
__rw_string_atomic_xxx() but no __rw_atomic_xxx() as on other platforms?
And also why the __rw_string_atomic_pre{in|de}crement(unsigned &__x,
bool)
are calling the (possibly undefined?)
__rw_atomic_pre{in|de}crement(int&, bool) ?

  The proposed patch below:

  ChangeLog:
  * include/rw/_mutex.h [_PA_RISC2_0]: Rename __rw_string_atomic_xxx()
to __rw_atmic_xxx() respectively.
  * include/rw/_defs.h [_PA_RISC2_0]: #define _RWSTD_STRING_ATOMIC_XXX
macros as _RWSTD_ATOMIC_XXX
  instead of __rw_string_atomic_xxx().

--------------------------------
Index: include/rw/_defs.h
===================================================================
--- include/rw/_defs.h	(revision 638458)
+++ include/rw/_defs.h	(working copy)
@@ -667,26 +667,13 @@
             _RWSTD_ATOMIC_SWAP(x, y, mutex)
 #  endif    // _RWSTD_NO_EXT_REENTRANT_IO
 
-#  if defined (_PA_RISC2_0)
+#  define _RWSTD_STRING_ATOMIC_PREINCREMENT(x, mutex)                \
+          _RWSTD_ATOMIC_PREINCREMENT (x, mutex)
+#  define _RWSTD_STRING_ATOMIC_PREDECREMENT(x, mutex)                \
+          _RWSTD_ATOMIC_PREDECREMENT (x, mutex)
+#  define _RWSTD_STRING_ATOMIC_SWAP(x, y, mutex)                     \
+          _RWSTD_ATOMIC_SWAP (x, y, mutex)
 
-#    define _RWSTD_STRING_ATOMIC_PREINCREMENT(x, mutex)              \
-            _RW::__rw_string_atomic_preincrement (x, mutex)
-
-#    define _RWSTD_STRING_ATOMIC_PREDECREMENT(x, mutex)              \
-            _RW::__rw_string_atomic_predecrement (x, mutex)
-
-#    define _RWSTD_STRING_ATOMIC_SWAP(x, y, mutex)                   \
-            _RW::__rw_string_atomic_exchange (x, y, mutex)
-
-#  else   // if !_PA_RISC2_0
-#    define _RWSTD_STRING_ATOMIC_PREINCREMENT(x, mutex)              \
-            _RWSTD_ATOMIC_PREINCREMENT (x, mutex)
-#    define _RWSTD_STRING_ATOMIC_PREDECREMENT(x, mutex)              \
-            _RWSTD_ATOMIC_PREDECREMENT (x, mutex)
-#    define _RWSTD_STRING_ATOMIC_SWAP(x, y, mutex)                   \
-            _RWSTD_ATOMIC_SWAP (x, y, mutex)
-#  endif   // !_PA_RISC2_0
-
    // thread-local storage
 #  ifndef _RWSTD_NO_TLS
 #    ifndef _RWSTD_THREAD
Index: include/rw/_mutex.h
===================================================================
--- include/rw/_mutex.h	(revision 638458)
+++ include/rw/_mutex.h	(working copy)
@@ -1136,14 +1136,14 @@
 
 
 inline int
-__rw_string_atomic_preincrement (int &__x, bool)
+__rw_atomic_preincrement (int &__x, bool)
 {
     return  __rw_atomic_incr32 (&__x);
 }
 
 
 inline unsigned
-__rw_string_atomic_preincrement (unsigned &__x, bool)
+__rw_atomic_preincrement (unsigned &__x, bool)
 {
   
     return __rw_atomic_preincrement (_RWSTD_REINTERPRET_CAST(int&,
__x),
@@ -1152,14 +1152,14 @@
 
 
 inline int
-__rw_string_atomic_predecrement (int &__x, bool)
+__rw_atomic_predecrement (int &__x, bool)
 {
     return  __rw_atomic_decr32 (&__x);
 }
 
 
 inline unsigned
-__rw_string_atomic_predecrement (unsigned &__x, bool)
+__rw_atomic_predecrement (unsigned &__x, bool)
 {
   
     return __rw_atomic_predecrement (_RWSTD_REINTERPRET_CAST(int&,
__x),
@@ -1168,18 +1168,18 @@
 
 
 inline int
-__rw_string_atomic_exchange (int &__x, int __y, bool)
+__rw_atomic_exchange (int &__x, int __y, bool)
 {
     return __rw_atomic_xchg32 (&__x, __y);
 }
 
 
 inline unsigned
-__rw_string_atomic_exchange (unsigned &__x, unsigned __y, bool)
+__rw_atomic_exchange (unsigned &__x, unsigned __y, bool)
 {
-    return __rw_string_atomic_exchange (_RWSTD_REINTERPRET_CAST(int&,
__x),
-                                        _RWSTD_STATIC_CAST(int,__y),
-                                        false);
+    return __rw_atomic_exchange (_RWSTD_REINTERPRET_CAST(int&, __x),
+                                 _RWSTD_STATIC_CAST(int,__y),
+                                 false);
 } 
 
 /********************** i386/gcc || _M_IX86
*********************************/
--------------------------------

Farid.

Mime
View raw message