stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov" <Farid_Zari...@epam.com>
Subject RE: __rw_once warnings in non-reentrant Windows builds?
Date Fri, 19 Oct 2007 14:28:14 GMT
> -----Original Message-----
> From: Martin Sebor [mailto:sebor@roguewave.com] 
> Sent: Tuesday, October 16, 2007 6:10 PM
> To: stdcxx-dev@incubator.apache.org
> Subject: Re: __rw_once warnings in non-reentrant Windows builds?
> 
> >   We could safely #undefine _RWSTD_REENTRANT macro for out 
> > single-threaded builds.
> 
> I think we *should* do that. The Visual Studio CRT can always 
> be thread safe but if we give our users the choice between 
> reentrant builds of stdcxx and non-reentrant ones and they 
> pick the latter we need to honor it.

  The patch is below.

> For 4.2.0, I think we just need to go with what we have now 
> but we should make this work right in 4.2.1.

  ChangeLog:
  * etc/config/windows/configure.wsf (configure): #define
_RWSTD_NO_REENTRANT macro
  in config.h file for single-threaded builds.
  * include/rw/_config-msvcrt.h: #define _RWSTD_REENTRANT macro only if
#defined _MT
  and not #defined _RWSTD_NO_REENTRANT, for single-threaded builds with
compilers,
  that doesn't have the single-threaded CRT (i.e MSVC 8, MSVC 9).

----------------------------------
Index: etc/config/windows/configure.wsf
===================================================================
--- etc/config/windows/configure.wsf	(revision 586373)
+++ etc/config/windows/configure.wsf	(working copy)
@@ -265,6 +265,11 @@
     // headers and functions check
     checkHeaders();
 
+    if (confInfo.mt)
+        appendLineToOutFile("// #define _RWSTD_NO_REENTRANT");
+    else
+        appendLineToOutFile("#define _RWSTD_NO_REENTRANT");
+
     // compile .lib.cpp s
     if (0 == compileLibs(confInfo.dll))
         cleanQuit(1, exitmsg);
Index: include/rw/_config-msvcrt.h
===================================================================
--- include/rw/_config-msvcrt.h	(revision 586373)
+++ include/rw/_config-msvcrt.h	(working copy)
@@ -185,7 +185,7 @@
 #  define _WIN32
 #endif
 
-#ifdef _MT
+#if defined (_MT) && !defined (_RWSTD_NO_REENTRANT)
 #  ifndef _RWSTD_REENTRANT
 #    define _RWSTD_REENTRANT 1
 #  endif   // _RWSTD_REENTRANT
@@ -196,11 +196,14 @@
 #      define _RWSTD_THREAD   __declspec (thread)
 #    endif   // _RWSTD_THREAD
 #  endif   // _RWSTD_NO_TLS
-#else   // if !defined (_MT)
+#else   // if !defined (_MT) || defined (_RWSTD_NO_REENTRANT)
+#  ifdef _RWSTD_REENTRANT
+#    undef _RWSTD_REENTRANT
+#  endif   // _RWSTD_REENTRANT
 #  ifndef _RWSTD_THREAD
 #    define _RWSTD_THREAD   /* empty */
 #  endif   // _RWSTD_THREAD
-#endif   //_MT
+#endif   // _MT && !_RWSTD_NO_REENTRANT
 
 #if defined (_CPPRTTI)
      // override in case library was configured with -GR-
----------------------------------

Farid.

Mime
View raw message