You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by fa...@apache.org on 2008/03/25 09:49:40 UTC

svn commit: r640746 - /stdcxx/trunk/src/locale_body.cpp

Author: faridz
Date: Tue Mar 25 01:49:39 2008
New Revision: 640746

URL: http://svn.apache.org/viewvc?rev=640746&view=rev
Log:
2008-03-25  Farid Zaripov  <fa...@epam.com>

	STDCXX-792
	* src/locale_body.cpp (_C_manage): Cast ginit to non-volatile to use the non-template 
	version of the __rw_atomic_preincrement() if available.
	Declare static variable ginit as int instead of long because the all native atomic
	functions are defined for int type and the overloads for long type just calls overload
	for int type on platforms where sizeof (int) == sizeof (long).

Modified:
    stdcxx/trunk/src/locale_body.cpp

Modified: stdcxx/trunk/src/locale_body.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/locale_body.cpp?rev=640746&r1=640745&r2=640746&view=diff
==============================================================================
--- stdcxx/trunk/src/locale_body.cpp (original)
+++ stdcxx/trunk/src/locale_body.cpp Tue Mar 25 01:49:39 2008
@@ -805,9 +805,11 @@
 
         if (!global) {
 
-            static volatile long ginit /* = 0 */;
+            static volatile int ginit /* = 0 */;
 
-            if (!ginit && 1 == _RWSTD_ATOMIC_PREINCREMENT (ginit, false)) {
+            // cast ginit to int& (STDCXX-792)
+            // casting should be removed after fixing STDCXX-794
+            if (!ginit && 1 == _RWSTD_ATOMIC_PREINCREMENT ((int&)ginit, false)) {
                 global  = _C_manage (0, "C");
                 ginit  += 1000;
             }