From d421cc6148b8573ae4284cb05be84eb936f44623 Mon Sep 17 00:00:00 2001 From: patthoyts Date: Tue, 26 Sep 2006 00:05:02 +0000 Subject: More fixing which struct stat to refer to. Some casts from time_t to int required. Tcl_Time structure members are longs. Support for varying compiler options and build to platform-specific subdirs. --- ChangeLog | 5 ++++ generic/tcl.h | 6 ++-- generic/tclGetDate.y | 26 +++++++++--------- generic/tclTimer.c | 8 +++--- win/makefile.vc | 30 ++++++++------------ win/rules.vc | 78 +++++++++++++++++++++++++++++++++++++++------------- win/tclWinDde.c | 4 +-- 7 files changed, 97 insertions(+), 60 deletions(-) diff --git a/ChangeLog b/ChangeLog index 16ee13f..6b2c509 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-09-25 Pat Thoyts + + * generic/tclTimer.c: Tcl_Time structure members are longs. + * generic/tclGetDate.y: Some casts from time_t to int required. + 2006-09-25 Andreas Kupries * generic/tclIO.c (Tcl_StackChannel): Fixed [SF Tcl Bug 1564642], diff --git a/generic/tcl.h b/generic/tcl.h index c32c063..657ab9d 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.214 2006/08/18 07:45:31 das Exp $ + * RCS: @(#) $Id: tcl.h,v 1.215 2006/09/26 00:05:02 patthoyts Exp $ */ #ifndef _TCL @@ -394,10 +394,10 @@ typedef struct stati64 Tcl_StatBuf; # define TCL_LL_MODIFIER "L" # define TCL_LL_MODIFIER_SIZE 1 # else /* __BORLANDC__ */ -# if _MSC_VER < 1400 +# if _MSC_VER < 1400 || !defined(_M_IX86) typedef struct _stati64 Tcl_StatBuf; # else -typedef struct __stat64 Tcl_StatBuf; +typedef struct _stat64 Tcl_StatBuf; # endif /* _MSC_VER < 1400 */ # define TCL_LL_MODIFIER "I64" # define TCL_LL_MODIFIER_SIZE 3 diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 2351139..412410e 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclGetDate.y,v 1.30 2005/11/27 02:33:49 das Exp $ + * RCS: @(#) $Id: tclGetDate.y,v 1.31 2006/09/26 00:05:03 patthoyts Exp $ */ %{ @@ -934,17 +934,17 @@ TclClockOldscanObjCmd( clientData, interp, objc, objv ) resultElement = Tcl_NewObj(); if ( yyHaveDate ) { Tcl_ListObjAppendElement( interp, resultElement, - Tcl_NewIntObj( yyYear ) ); + Tcl_NewIntObj( (int) yyYear ) ); Tcl_ListObjAppendElement( interp, resultElement, - Tcl_NewIntObj( yyMonth ) ); + Tcl_NewIntObj( (int) yyMonth ) ); Tcl_ListObjAppendElement( interp, resultElement, - Tcl_NewIntObj( yyDay ) ); + Tcl_NewIntObj( (int) yyDay ) ); } Tcl_ListObjAppendElement( interp, result, resultElement ); if ( yyHaveTime ) { Tcl_ListObjAppendElement( interp, result, - Tcl_NewIntObj( ToSeconds( yyHour, + Tcl_NewIntObj( (int) ToSeconds( yyHour, yyMinutes, yySeconds, yyMeridian ) ) ); @@ -955,7 +955,7 @@ TclClockOldscanObjCmd( clientData, interp, objc, objv ) resultElement = Tcl_NewObj(); if ( yyHaveZone ) { Tcl_ListObjAppendElement( interp, resultElement, - Tcl_NewIntObj( -yyTimezone ) ); + Tcl_NewIntObj( (int) -yyTimezone ) ); Tcl_ListObjAppendElement( interp, resultElement, Tcl_NewIntObj( 1-yyDSTmode ) ); } @@ -964,29 +964,29 @@ TclClockOldscanObjCmd( clientData, interp, objc, objv ) resultElement = Tcl_NewObj(); if ( yyHaveRel ) { Tcl_ListObjAppendElement( interp, resultElement, - Tcl_NewIntObj( yyRelMonth ) ); + Tcl_NewIntObj( (int) yyRelMonth ) ); Tcl_ListObjAppendElement( interp, resultElement, - Tcl_NewIntObj( yyRelDay ) ); + Tcl_NewIntObj( (int) yyRelDay ) ); Tcl_ListObjAppendElement( interp, resultElement, - Tcl_NewIntObj( yyRelSeconds ) ); + Tcl_NewIntObj( (int) yyRelSeconds ) ); } Tcl_ListObjAppendElement( interp, result, resultElement ); resultElement = Tcl_NewObj(); if ( yyHaveDay && !yyHaveDate ) { Tcl_ListObjAppendElement( interp, resultElement, - Tcl_NewIntObj( yyDayOrdinal ) ); + Tcl_NewIntObj( (int) yyDayOrdinal ) ); Tcl_ListObjAppendElement( interp, resultElement, - Tcl_NewIntObj( yyDayNumber ) ); + Tcl_NewIntObj( (int) yyDayNumber ) ); } Tcl_ListObjAppendElement( interp, result, resultElement ); resultElement = Tcl_NewObj(); if ( yyHaveOrdinalMonth ) { Tcl_ListObjAppendElement( interp, resultElement, - Tcl_NewIntObj( yyMonthOrdinal ) ); + Tcl_NewIntObj( (int) yyMonthOrdinal ) ); Tcl_ListObjAppendElement( interp, resultElement, - Tcl_NewIntObj( yyMonth ) ); + Tcl_NewIntObj( (int) yyMonth ) ); } Tcl_ListObjAppendElement( interp, result, resultElement ); diff --git a/generic/tclTimer.c b/generic/tclTimer.c index b867287..49e0e6e 100644 --- a/generic/tclTimer.c +++ b/generic/tclTimer.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: tclTimer.c,v 1.22 2005/12/13 22:43:18 kennykb Exp $ + * RCS: @(#) $Id: tclTimer.c,v 1.23 2006/09/26 00:05:03 patthoyts Exp $ */ #include "tclInt.h" @@ -860,8 +860,8 @@ Tcl_AfterObjCmd( afterPtr->id = tsdPtr->afterId; tsdPtr->afterId += 1; Tcl_GetTime(&wakeup); - wakeup.sec += (time_t)(ms / 1000); - wakeup.usec += ((int)(ms % 1000)) * 1000; + wakeup.sec += (long)(ms / 1000); + wakeup.usec += ((long)(ms % 1000)) * 1000; if (wakeup.usec > 1000000) { wakeup.sec++; wakeup.usec -= 1000000; @@ -1004,7 +1004,7 @@ AfterDelay( Tcl_WideInt diff; Tcl_GetTime(&endTime); - endTime.sec += (time_t)(ms/1000); + endTime.sec += (long)(ms/1000); endTime.usec += ((int)(ms%1000))*1000; if (endTime.usec >= 1000000) { endTime.sec++; diff --git a/win/makefile.vc b/win/makefile.vc index 4fd5f94..62222de 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -12,7 +12,7 @@ # Copyright (c) 2001-2004 David Gravereaux. # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: makefile.vc,v 1.148 2006/09/21 14:56:15 vincentdarley Exp $ +# RCS: @(#) $Id: makefile.vc,v 1.149 2006/09/26 00:05:03 patthoyts Exp $ #------------------------------------------------------------------------------ # Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR) @@ -416,12 +416,6 @@ 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 @@ -433,11 +427,12 @@ cdebug = ### Warnings are too many, can't support warnings into errors. cdebug = -Z7 -Od $(DEBUGFLAGS) !else -cdebug = -Z7 -Od $(DEBUGFLAGS) +cdebug = -Z7 -WX $(DEBUGFLAGS) !endif ### Declarations common to all compiler options -cflags = -nologo -c -Fp$(TMP_DIR)^\ +cwarn = -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE +cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ !if $(FULLWARNINGS) cflags = $(cflags) -W4 @@ -445,15 +440,6 @@ cflags = $(cflags) -W4 cflags = $(cflags) -W3 !endif - -!if $(PENT_0F_ERRATA) -cflags = $(cflags) -QI0f -!endif - -!if $(ITAN_B_ERRATA) -cflags = $(cflags) -QIA64_Bx -!endif - !if $(MSVCRT) !if $(DEBUG) && !$(UNCHECKED) crt = -MDd @@ -581,6 +567,7 @@ $** $(baselibs) @<< $** << + $(_VC_MANIFEST_EMBED_DLL) -@del $*.exp !endif @@ -589,13 +576,16 @@ $(TCLSTUBLIB): $(TCLSTUBOBJS) $(TCLSH): $(TCLSHOBJS) $(TCLIMPLIB) $(link32) $(conlflags) -stack:2300000 -out:$@ $(baselibs) $** + $(_VC_MANIFEST_EMBED_EXE) $(TCLTEST): $(TCLTESTOBJS) $(TCLIMPLIB) $(link32) $(conlflags) -stack:2300000 -out:$@ $(baselibs) $** + $(_VC_MANIFEST_EMBED_EXE) $(TCLPIPEDLL): $(WINDIR)\stub16.c $(cc32) $(CON_CFLAGS) -Fo$(TMP_DIR)\ $(WINDIR)\stub16.c $(link32) $(conlflags) -out:$@ $(TMP_DIR)\stub16.obj $(baselibs) + $(_VC_MANIFEST_EMBED_DLL) !if $(STATIC_BUILD) !if !$(TCL_USE_STATIC_PACKAGES) @@ -606,6 +596,7 @@ $(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj $(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj $(TCLSTUBLIB) $(link32) $(dlllflags) -base:@$(WINDIR)\coffbase.txt,tcldde -out:$@ \ $** $(baselibs) + $(_VC_MANIFEST_EMBED_DLL) -@del $*.exp -@del $*.lib !endif @@ -619,6 +610,7 @@ $(TCLREGLIB): $(TMP_DIR)\tclWinReg.obj $(TCLREGLIB): $(TMP_DIR)\tclWinReg.obj $(TCLSTUBLIB) $(link32) $(dlllflags) -base:@$(WINDIR)\coffbase.txt,tclreg -out:$@ \ $** $(baselibs) + $(_VC_MANIFEST_EMBED_DLL) -@del $*.exp -@del $*.lib !endif @@ -627,7 +619,7 @@ $(CAT32): $(WINDIR)\cat.c $(cc32) $(CON_CFLAGS) -Fo$(TMP_DIR)\ $? $(link32) $(conlflags) -out:$@ -stack:16384 $(TMP_DIR)\cat.obj \ $(baselibs) - + $(_VC_MANIFEST_EMBED_EXE) #--------------------------------------------------------------------- # Regenerate the stubs files. [Development use only] diff --git a/win/rules.vc b/win/rules.vc index 68e490d..1a1bda6 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -8,9 +8,10 @@ # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # Copyright (c) 2001-2003 David Gravereaux. +# Copyright (c) 2003-2006 Patrick Thoyts # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: rules.vc,v 1.23 2006/09/11 21:24:38 patthoyts Exp $ +# RCS: @(#) $Id: rules.vc,v 1.24 2006/09/26 00:05:03 patthoyts Exp $ #------------------------------------------------------------------------------ !ifndef _RULES_VC @@ -25,7 +26,7 @@ rc32 = $(RC) # built-in default. ### Assume the normal default. _INSTALLDIR = C:\Program Files\Tcl !else -### Fix the path seperators. +### Fix the path separators. _INSTALLDIR = $(INSTALLDIR:/=\) !endif @@ -74,7 +75,7 @@ COPY = copy /y >NUL #---------------------------------------------------------- ### test for optimizations -!if [nmakehlp -c -Oti] +!if [nmakehlp -c -Ot] !message *** Compiler has 'Optimizations' OPTIMIZING = 1 !else @@ -82,7 +83,15 @@ OPTIMIZING = 1 OPTIMIZING = 0 !endif -OPTIMIZATIONS = +OPTIMIZATIONS = + +!if [nmakehlp -c -Ot] +OPTIMIZATIONS = $(OPTIMIZATIONS) -Ot +!endif + +!if [nmakehlp -c -Oi] +OPTIMIZATIONS = $(OPTIMIZATIONS) -Oi +!endif !if [nmakehlp -c -Op] OPTIMIZATIONS = $(OPTIMIZATIONS) -Op @@ -108,15 +117,33 @@ DEBUGFLAGS = $(DEBUGFLAGS) -RTC1 DEBUGFLAGS = $(DEBUGFLAGS) -GZ !endif +COMPILERFLAGS =-W3 + +!if [nmakehlp -c -YX] +OPTIMIZATIONS = $(OPTIMIZATIONS) -YX +!endif + !if "$(MACHINE)" == "IX86" ### test for pentium errata !if [nmakehlp -c -QI0f] !message *** Compiler has 'Pentium 0x0f fix' -PENT_0F_ERRATA = 1 +COMPILERFLAGS = $(COMPILERFLAGSS) -QI0f !else !message *** Compiler doesn't have 'Pentium 0x0f fix' -PENT_0F_ERRATA = 0 !endif +!endif + +!if "$(MACHINE)" == "IA64" +### test for Itanium errata +!if [nmakehlp -c -QIA64_Bx] +!message *** Compiler has 'B-stepping errata workarounds' +COMPILERFLAGS = $(COMPILERFLAGS) -QIA64_Bx +!else +!message *** Compiler does not have 'B-stepping errata workarounds' +!endif +!endif + +!if "$(MACHINE)" == "IX86" ### test for -align:4096, when align:512 will do. !if [nmakehlp -l -opt:nowin98] !message *** Linker has 'Win98 alignment problem' @@ -126,21 +153,26 @@ ALIGN98_HACK = 1 ALIGN98_HACK = 0 !endif !else -PENT_0F_ERRATA = 0 ALIGN98_HACK = 0 !endif -!if "$(MACHINE)" == "IA64" -### test for Itanium errata -!if [nmakehlp -c -QIA64_Bx] -!message *** Compiler has 'B-stepping errata workarounds' -ITAN_B_ERRATA = 1 -!else -!message *** Compiler doesn't have 'B-stepping errata workarounds' -ITAN_B_ERRATA = 0 -!endif +#---------------------------------------------------------- +# MSVC8 (ships with Visual Studio 2005) generates a manifest +# file that we should link into the binaries. This is how. +#---------------------------------------------------------- + +_VC_MANIFEST_EMBED_EXE= +_VC_MANIFEST_EMBED_DLL= +!if ![cl /Zs /Tc NUL 2>&1 | find "Version 12" > NUL] +VCVER=6 +!elseif ![cl /Zs /Tc NUL 2>&1 | find "Version 13" > NUL] +VCVER=7 +!elseif ![cl /Zs /Tc NUL 2>&1 | find "Version 14" > NUL] +VCVER=8 +_VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1 +_VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2 !else -ITAN_B_ERRATA = 0 +VCVER=0 !endif #---------------------------------------------------------- @@ -247,6 +279,13 @@ BUILDDIRTOP = Debug BUILDDIRTOP = Release !endif +!if "$(MACHINE)" != "IX86" +BUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE) +!endif +!if $(VCVER) > 6 +BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER) +!endif + !if !$(DEBUG) || $(DEBUG) && $(UNCHECKED) SUFX = $(SUFX:g=) !endif @@ -384,7 +423,7 @@ TCLINSTALL = 1 _TCLDIR = $(_INSTALLDIR) !else MSG=^ -Don't know where tcl.h is. Set the TCLDIR macro. +Failed to find tcl.h. Set the TCLDIR macro. !error $(MSG) !endif !else @@ -397,7 +436,7 @@ TCLH = "$(_TCLDIR)\generic\tcl.h" TCLINSTALL = 0 !else MSG =^ -Don't know where tcl.h is. The TCLDIR macro doesn't appear correct. +Failed to find tcl.h. The TCLDIR macro does not appear correct. !error $(MSG) !endif !endif @@ -470,5 +509,6 @@ TCLTOOLSDIR = $(_TCLDIR)\tools !message *** Output directory will be '$(OUT_DIR)' !message *** Suffix for binaries will be '$(SUFX)' !message *** Optional defines are '$(OPTDEFINES)' +!message *** Compiler version $(VCVER) options are '$(OPTIMIZATIONS) $(DEBUGFLAGS)' !endif diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 5c38115..bcd086e 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.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: tclWinDde.c,v 1.30 2006/04/05 16:32:44 dgp Exp $ + * RCS: @(#) $Id: tclWinDde.c,v 1.31 2006/09/26 00:05:03 patthoyts Exp $ */ #include "tclInt.h" @@ -378,7 +378,7 @@ DdeSetServerName( } } Tcl_DStringSetLength(&dString, - offset + strlen(Tcl_DStringValue(&dString)+offset)); + offset + (int)strlen(Tcl_DStringValue(&dString)+offset)); } /* -- cgit v0.12