Subject: Make compilation of the fp control changes possible with MinGW.

From: Joe Mistachkin <[email-masked]>
Date: Thu, 13 Sep 2012 20:03:01 +0000

---
 win/tclWinThrd.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index 86ff6a5..21d422f 100644
--- a/win/tclWinThrd.c
+++ b/win/tclWinThrd.c
@@ -160,7 +160,7 @@ TclWinThreadStart(
 				 * from TclpThreadCreate */
 {
     WinThread *winThreadPtr = (WinThread *) lpParameter;
-    unsigned int fpmask = _MCW_EM | _MCW_RC | _MCW_PC | _MCW_DN;
+    unsigned int fpmask;
     LPTHREAD_START_ROUTINE lpOrigStartAddress;
     LPVOID lpOrigParameter;
 
@@ -168,6 +168,12 @@ TclWinThreadStart(
 	return TCL_ERROR;
     }
 
+    fpmask = _MCW_EM | _MCW_RC | _MCW_PC;
+
+#if defined(_MSC_VER) && _MSC_VER >= 1200
+    fpmask |= _MCW_DN;
+#endif
+
     _controlfp(winThreadPtr->fpControl, fpmask);
 
     lpOrigStartAddress = winThreadPtr->lpStartAddress;
@@ -207,7 +213,7 @@ TclpThreadCreate(idPtr, proc, clientData, stackSize, flags)
     HANDLE tHandle;
 
     winThreadPtr = (WinThread *)ckalloc(sizeof(WinThread));
-    winThreadPtr->lpStartAddress = proc;
+    winThreadPtr->lpStartAddress = (LPTHREAD_START_ROUTINE) proc;
     winThreadPtr->lpParameter = clientData;
     winThreadPtr->fpControl = _controlfp(0, 0);
 
@@ -215,7 +221,8 @@ TclpThreadCreate(idPtr, proc, clientData, stackSize, flags)
 
 #if defined(_MSC_VER) || defined(__MSVCRT__) || defined(__BORLANDC__)
     tHandle = (HANDLE) _beginthreadex(NULL, (unsigned) stackSize,
-	    TclWinThreadStart, winThreadPtr, 0, (unsigned *)idPtr);
+	    (Tcl_ThreadCreateProc*) TclWinThreadStart, winThreadPtr,
+	    0, (unsigned *)idPtr);
 #else
     tHandle = CreateThread(NULL, (DWORD) stackSize,
 	    TclWinThreadStart, winThreadPtr, 0, (LPDWORD)idPtr);
-- 
cgit v0.12