stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: [PATCH] atomic ops on _PA_RISC2_0
Date Wed, 19 Mar 2008 16:35:41 GMT
Farid Zaripov wrote:
>   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?

I'm not sure but I wonder if the PA atomic functions aren't
the ones that reserve a specific value as the lock value.
I.e., they're not completely general as on all the other
architectures. Which isn't necessarily an argument for not
renaming them, just a possible explanation.

> 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) ?

No idea.

> 
>   The proposed patch below:

This looks like a patch for STDCXX-43 (scheduled for 5.0 for
compatibility reasons).

We should probably discuss how to deal with these kinds of
patches. Maybe it's time to create a 5.0 branch (and 4.3),
and decide what goes on trunk...

Martin

> 
>   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