From 34dbae7d6c29485684a2de0432b01702ce074d54 Mon Sep 17 00:00:00 2001 From: mdejong Date: Tue, 14 Jan 2003 02:06:10 +0000 Subject: Fix mingw build problems and compiler warnings. * generic/tcl.h: Add if defined(__MINGW32__) check to code that sets the TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER. * generic/tclClock.c (FormatClock): Don't define savedTimeZone and savedTZEnv if we are not going to use them. * generic/tclEnv.c: Add cast to avoid warning. * win/tclWinChan.c: Use DWORD instead of int to avoid compiler warning. * win/tclWinThrd.c: Only define allocLock, allocLockPtr, and dataKey when TCL_THREADS is defined. This avoid a compiler warning about unused variables. --- ChangeLog | 18 ++++++++++++++++++ generic/tcl.h | 4 ++-- generic/tclClock.c | 4 ++-- generic/tclEnv.c | 4 ++-- win/tclWinChan.c | 8 ++++---- win/tclWinThrd.c | 10 +++++++++- 6 files changed, 37 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index f489aa1..f81c1cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2003-01-13 Mo DeJong + + Fix mingw build problems and compiler warnings. + + * generic/tcl.h: Add if defined(__MINGW32__) + check to code that sets the TCL_WIDE_INT_TYPE + and TCL_LL_MODIFIER. + * generic/tclClock.c (FormatClock): Don't + define savedTimeZone and savedTZEnv if + we are not going to use them. + * generic/tclEnv.c: Add cast to avoid warning. + * win/tclWinChan.c: Use DWORD instead of int + to avoid compiler warning. + * win/tclWinThrd.c: Only define allocLock, + allocLockPtr, and dataKey when TCL_THREADS + is defined. This avoid a compiler warning + about unused variables. + 2003-01-12 Mo DeJong * win/README: Update msys + mingw URL, the diff --git a/generic/tcl.h b/generic/tcl.h index b89bb59..7a6fd2a 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.149 2003/01/13 07:01:06 mdejong Exp $ + * RCS: @(#) $Id: tcl.h,v 1.150 2003/01/14 02:06:10 mdejong Exp $ */ #ifndef _TCL @@ -353,7 +353,7 @@ typedef long LONG; */ #if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG) -# ifdef __CYGWIN__ +# if defined(__CYGWIN__) || defined(__MINGW32__) # define TCL_WIDE_INT_TYPE long long # define TCL_LL_MODIFIER "L" typedef struct stat Tcl_StatBuf; diff --git a/generic/tclClock.c b/generic/tclClock.c index 549cc0a..774f72a 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -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: tclClock.c,v 1.16 2002/07/05 11:16:01 rmax Exp $ + * RCS: @(#) $Id: tclClock.c,v 1.17 2003/01/14 02:06:11 mdejong Exp $ */ #include "tcl.h" @@ -263,7 +263,7 @@ FormatClock(interp, clockVal, useGMT, format) char *p; int result; time_t tclockVal; -#ifndef HAVE_TM_ZONE +#if defined(HAVE_TM_ZONE) && !defined(WIN32) int savedTimeZone = 0; /* lint. */ char *savedTZEnv = NULL; /* lint. */ #endif diff --git a/generic/tclEnv.c b/generic/tclEnv.c index e0e2739..1d6e66f 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclEnv.c,v 1.19 2002/10/14 22:25:10 hobbs Exp $ + * RCS: @(#) $Id: tclEnv.c,v 1.20 2003/01/14 02:06:11 mdejong Exp $ */ #include "tclInt.h" @@ -409,7 +409,7 @@ TclUnsetEnv(name) */ #ifdef USE_PUTENV - string = ckalloc(length+2); + string = ckalloc((unsigned int) length+2); memcpy((VOID *) string, (VOID *) name, (size_t) length); string[length] = '='; string[length+1] = '\0'; diff --git a/win/tclWinChan.c b/win/tclWinChan.c index e6b61b3..3799ee5 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.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: tclWinChan.c,v 1.26 2002/11/27 22:57:18 davygrvy Exp $ + * RCS: @(#) $Id: tclWinChan.c,v 1.27 2003/01/14 02:06:11 mdejong Exp $ */ #include "tclWinInt.h" @@ -467,7 +467,7 @@ FileSeekProc(instanceData, offset, mode, errorCodePtr) oldPos = SetFilePointer(infoPtr->handle, (LONG)0, &oldPosHigh, FILE_CURRENT); if (oldPos == INVALID_SET_FILE_POINTER) { - int winError = GetLastError(); + DWORD winError = GetLastError(); if (winError != NO_ERROR) { TclWinConvertError(winError); *errorCodePtr = errno; @@ -479,7 +479,7 @@ FileSeekProc(instanceData, offset, mode, errorCodePtr) newPos = SetFilePointer(infoPtr->handle, (LONG) offset, &newPosHigh, moveMethod); if (newPos == INVALID_SET_FILE_POINTER) { - int winError = GetLastError(); + DWORD winError = GetLastError(); if (winError != NO_ERROR) { TclWinConvertError(winError); *errorCodePtr = errno; @@ -540,7 +540,7 @@ FileWideSeekProc(instanceData, offset, mode, errorCodePtr) newPos = SetFilePointer(infoPtr->handle, (LONG) offset, &newPosHigh, moveMethod); if (newPos == INVALID_SET_FILE_POINTER) { - int winError = GetLastError(); + DWORD winError = GetLastError(); if (winError != NO_ERROR) { TclWinConvertError(winError); *errorCodePtr = errno; diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 80b6be0..f0ee02c 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.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: tclWinThrd.c,v 1.23 2002/12/10 00:34:15 hobbs Exp $ + * RCS: @(#) $Id: tclWinThrd.c,v 1.24 2003/01/14 02:06:11 mdejong Exp $ */ #include "tclWinInt.h" @@ -40,9 +40,13 @@ static CRITICAL_SECTION initLock; * For obvious reasons, cannot use any dyamically allocated storage. */ +#ifdef TCL_THREADS + static CRITICAL_SECTION allocLock; static Tcl_Mutex allocLockPtr = (Tcl_Mutex) &allocLock; +#endif /* TCL_THREADS */ + /* * The joinLock serializes Create- and ExitThread. This is necessary to * prevent a race where a new joinable thread exits before the creating @@ -69,6 +73,8 @@ static CRITICAL_SECTION joinLock; * The per-thread event and queue pointers. */ +#ifdef TCL_THREADS + typedef struct ThreadSpecificData { HANDLE condEvent; /* Per-thread condition event */ struct ThreadSpecificData *nextPtr; /* Queue pointers */ @@ -77,6 +83,8 @@ typedef struct ThreadSpecificData { } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; +#endif /* TCL_THREADS */ + /* * State bits for the thread. * WIN_THREAD_UNINIT Uninitialized. Must be zero because -- cgit v0.12