summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2005-11-03 00:17:30 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2005-11-03 00:17:30 (GMT)
commit2ac3a08a98a293de62ed6ae01aa7a7d139660207 (patch)
tree86fab92b7dc7b1f3c9f8d9b9a0ead95a215fd1cd /win
parent4299352915cf05025553108f48b7bf58f48a8353 (diff)
downloadtcl-2ac3a08a98a293de62ed6ae01aa7a7d139660207.zip
tcl-2ac3a08a98a293de62ed6ae01aa7a7d139660207.tar.gz
tcl-2ac3a08a98a293de62ed6ae01aa7a7d139660207.tar.bz2
Applied patch #1096916 to support building with MSVC 8.
* generic/regerror.c: Avoid use of reserved word. * generic/tcl.h: Select the right Tcl_Stat structure * generic/tclDate.c: Casts to handle 64 bit time_t case. * tests/env.test: Include essential envvar on Win32 * win/nmakehlp.c: Handle new return codes. * win/makefile.vc: Use the selected options. * win/rules.vc: Check options are applicable * win/tclWinPort.h: Disable deprecated function warnings * win/tclWinSock.c: Provide default value to avoid warning. * win/tclWinTime.c: Add casts to handle 64bit time_t type.
Diffstat (limited to 'win')
-rw-r--r--win/makefile.vc21
-rw-r--r--win/nmakehlp.c11
-rw-r--r--win/rules.vc32
-rw-r--r--win/tclWinPort.h13
-rw-r--r--win/tclWinSock.c4
-rw-r--r--win/tclWinTime.c18
6 files changed, 74 insertions, 25 deletions
diff --git a/win/makefile.vc b/win/makefile.vc
index da38877..d74f505 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -12,12 +12,13 @@
# Copyright (c) 2001-2004 David Gravereaux.
#
#------------------------------------------------------------------------------
-# RCS: @(#) $Id: makefile.vc,v 1.140 2005/10/08 14:42:54 dgp Exp $
+# RCS: @(#) $Id: makefile.vc,v 1.141 2005/11/03 00:17:31 patthoyts Exp $
#------------------------------------------------------------------------------
# Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR)
-# or with the MS Platform SDK (MSSDK)
-!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(MSSDK)
+# or with the MS Platform SDK (MSSDK). Visual Studio .NET 2003 and 2005 define
+# VCINSTALLDIR instead.
+!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(MSSDK) && !defined(VCINSTALLDIR)
MSG = ^
You need to run vcvars32.bat from Developer Studio or setenv.bat from the^
Platform SDK first to setup the environment. Jump to this line to read^
@@ -415,22 +416,28 @@ WINDIR = $(ROOT)\win
# Compile flags
#---------------------------------------------------------------------
+# MSVC 2005 changes:
+# -Op gone, use /fp:precise ?
+# /QI0f has been removed.
+# /YX removed - use /Yc or /Yu or better nothing.
+# /GS and /GR are on by default
+
!if !$(DEBUG)
!if $(OPTIMIZING)
### This cranks the optimization level to maximize speed
-cdebug = -O2 -Op -Gs
+cdebug = -O2 $(OPTIMIZATIONS)
!else
cdebug =
!endif
!else if "$(MACHINE)" == "IA64"
### Warnings are too many, can't support warnings into errors.
-cdebug = -Z7 -Od -GZ
+cdebug = -Z7 -Od $(DEBUGFLAGS)
!else
-cdebug = -Z7 -WX -Od -GZ
+cdebug = -Z7 -Od $(DEBUGFLAGS)
!endif
### Declarations common to all compiler options
-cflags = -nologo -c -YX -Fp$(TMP_DIR)^\
+cflags = -nologo -c -Fp$(TMP_DIR)^\
!if $(FULLWARNINGS)
cflags = $(cflags) -W4
diff --git a/win/nmakehlp.c b/win/nmakehlp.c
index 4599315..d1fb6b4 100644
--- a/win/nmakehlp.c
+++ b/win/nmakehlp.c
@@ -9,7 +9,7 @@
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* ----------------------------------------------------------------------------
- * RCS: @(#) $Id: nmakehlp.c,v 1.7 2004/02/10 22:04:04 davygrvy Exp $
+ * RCS: @(#) $Id: nmakehlp.c,v 1.8 2005/11/03 00:17:31 patthoyts Exp $
* ----------------------------------------------------------------------------
*/
#include <windows.h>
@@ -192,8 +192,13 @@ CheckForCompilerFeature (const char *option)
CloseHandle(pipeThreads[0]);
CloseHandle(pipeThreads[1]);
- /* look for the commandline warning code in both streams. */
- return !(strstr(Out.buffer, "D4002") != NULL || strstr(Err.buffer, "D4002") != NULL);
+ /* look for the commandline warning code in both streams.
+ * - in MSVC 6 & 7 we get D4002, in MSVC 8 we get D9002.
+ */
+ return !(strstr(Out.buffer, "D4002") != NULL
+ || strstr(Err.buffer, "D4002") != NULL
+ || strstr(Out.buffer, "D9002") != NULL
+ || strstr(Err.buffer, "D9002") != NULL);
}
int
diff --git a/win/rules.vc b/win/rules.vc
index cfa4baa..6c595bc 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -10,7 +10,7 @@
# Copyright (c) 2001-2003 David Gravereaux.
#
#------------------------------------------------------------------------------
-# RCS: @(#) $Id: rules.vc,v 1.21 2005/08/11 22:06:47 kennykb Exp $
+# RCS: @(#) $Id: rules.vc,v 1.22 2005/11/03 00:17:31 patthoyts Exp $
#------------------------------------------------------------------------------
!ifndef _RULES_VC
@@ -64,7 +64,7 @@ RMDIR = deltree /Y
#----------------------------------------------------------
!if !exist(nmakehlp.exe)
-!if [$(cc32) -nologo -ML nmakehlp.c -link -subsystem:console > nul]
+!if [$(cc32) -nologo nmakehlp.c -link -subsystem:console > nul]
!endif
!endif
@@ -73,7 +73,7 @@ RMDIR = deltree /Y
#----------------------------------------------------------
### test for optimizations
-!if [nmakehlp -c -Otip]
+!if [nmakehlp -c -Oti]
!message *** Compiler has 'Optimizations'
OPTIMIZING = 1
!else
@@ -81,6 +81,32 @@ OPTIMIZING = 1
OPTIMIZING = 0
!endif
+OPTIMIZATIONS =
+
+!if [nmakehlp -c -Op]
+OPTIMIZATIONS = $(OPTIMIZATIONS) -Op
+!endif
+
+!if [nmakehlp -c -fp:strict]
+OPTIMIZATIONS = $(OPTIMIZATIONS) -fp:strict
+!endif
+
+!if [nmakehlp -c -Gs]
+OPTIMIZATIONS = $(OPTIMIZATIONS) -Gs
+!endif
+
+!if [nmakehlp -c -GS]
+OPTIMIZATIONS = $(OPTIMIZATIONS) -GS
+!endif
+
+DEBUGFLAGS =
+
+!if [nmakehlp -c -RTC1]
+DEBUGFLAGS = $(DEBUGFLAGS) -RTC1
+!elseif [nmakehlp -c -GZ]
+DEBUGFLAGS = $(DEBUGFLAGS) -GZ
+!endif
+
!if "$(MACHINE)" == "IX86"
### test for pentium errata
!if [nmakehlp -c -QI0f]
diff --git a/win/tclWinPort.h b/win/tclWinPort.h
index 4c11208..984682f 100644
--- a/win/tclWinPort.h
+++ b/win/tclWinPort.h
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinPort.h,v 1.45 2005/10/05 08:03:35 hobbs Exp $
+ * RCS: @(#) $Id: tclWinPort.h,v 1.46 2005/11/03 00:17:31 patthoyts Exp $
*/
#ifndef _TCLWINPORT
@@ -413,6 +413,17 @@
# endif
#endif
+
+/*
+ * MSVC 8.0 started to mark many standard C library functions depreciated
+ * including the *printf family and others. Tell it to shut up.
+ * (_MSC_VER is 1200 for VC6, 1300 or 1310 for vc7.net, 1400 for 8.0)
+ */
+#if _MSC_VER >= 1400
+#pragma warning(disable:4996)
+#endif
+
+
/*
* There is no platform-specific panic routine for Windows in the Tcl internals.
*/
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 10c24bd..030518a 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinSock.c,v 1.48 2005/07/24 22:56:50 dkf Exp $
+ * RCS: @(#) $Id: tclWinSock.c,v 1.49 2005/11/03 00:17:31 patthoyts Exp $
*/
#include "tclWinInt.h"
@@ -1079,7 +1079,7 @@ CreateSocket(interp, port, host, server, myaddr, myport, async)
* progress. */
SOCKADDR_IN sockaddr; /* Socket address */
SOCKADDR_IN mysockaddr; /* Socket address for client */
- SOCKET sock;
+ SOCKET sock = INVALID_SOCKET;
SocketInfo *infoPtr; /* The returned value. */
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
TclThreadDataKeyGet(&dataKey);
diff --git a/win/tclWinTime.c b/win/tclWinTime.c
index fc91e2b..0b8ebfa 100644
--- a/win/tclWinTime.c
+++ b/win/tclWinTime.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinTime.c,v 1.31 2005/07/24 22:56:51 dkf Exp $
+ * RCS: @(#) $Id: tclWinTime.c,v 1.32 2005/11/03 00:17:31 patthoyts Exp $
*/
#include "tclInt.h"
@@ -464,7 +464,7 @@ NativeGetTime(timePtr, clientData)
timeInfo.fileTimeLastCall.QuadPart = curFileTime;
timeInfo.perfCounterLastCall.QuadPart = curCounter.QuadPart;
usecSincePosixEpoch = (curFileTime - posixEpoch.QuadPart) / 10;
- timePtr->sec = (time_t) (usecSincePosixEpoch / 1000000);
+ timePtr->sec = (long) (usecSincePosixEpoch / 1000000);
timePtr->usec = (unsigned long) (usecSincePosixEpoch % 1000000);
useFtime = 0;
}
@@ -478,7 +478,7 @@ NativeGetTime(timePtr, clientData)
*/
ftime(&t);
- timePtr->sec = t.time;
+ timePtr->sec = (long)t.time;
timePtr->usec = t.millitm * 1000;
}
}
@@ -701,9 +701,9 @@ TclpGetDate(t, useGMT)
}
time /= 24;
- tmPtr->tm_mday += time;
- tmPtr->tm_yday += time;
- tmPtr->tm_wday = (tmPtr->tm_wday + time) % 7;
+ tmPtr->tm_mday += (int)time;
+ tmPtr->tm_yday += (int)time;
+ tmPtr->tm_wday = (tmPtr->tm_wday + (int)time) % 7;
}
} else {
tmPtr = ComputeGMT(t);
@@ -744,8 +744,8 @@ ComputeGMT(tp)
* Compute the 4 year span containing the specified time.
*/
- tmp = *tp / SECSPER4YEAR;
- rem = *tp % SECSPER4YEAR;
+ tmp = (long)(*tp / SECSPER4YEAR);
+ rem = (long)(*tp % SECSPER4YEAR);
/*
* Correct for weird mod semantics so the remainder is always positive.
@@ -812,7 +812,7 @@ ComputeGMT(tp)
* Compute day of week. Epoch started on a Thursday.
*/
- tmPtr->tm_wday = (*tp / SECSPERDAY) + 4;
+ tmPtr->tm_wday = (long)(*tp / SECSPERDAY) + 4;
if ((*tp % SECSPERDAY) < 0) {
tmPtr->tm_wday--;
}