From ca1cacf50dec50820fccecc8e3dc43820e6f4f63 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Mon, 14 Jun 2010 12:58:11 +0000 Subject: Fix compilation of xttest with 8.6 changes tclPipe.c: Fix gcc warning (with -fstrict-aliasing=2) --- ChangeLog | 7 +++++++ generic/tclPipe.c | 19 ++++++++----------- unix/Makefile.in | 15 ++++++++------- unix/tclXtNotify.c | 31 +++++++++++++++++-------------- unix/tclXtTest.c | 16 +++++----------- 5 files changed, 45 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index 525d59c..34e0752 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-06-14 Jan Nijtmans + + * unix/Makefile.in Fix compilation of xttest with 8.6 changes + * unix/tclXtNotify.c + * unix/tclXtTest.c + * generic/tclPipe.c Fix gcc warning (with -fstrict-aliasing=2) + 2010-06-13 Donal K. Fellows * tools/tcltk-man2html.tcl (make-man-pages): [Bug 3015327]: Make the diff --git a/generic/tclPipe.c b/generic/tclPipe.c index 37dd5b1..cbefbc1 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.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: tclPipe.c,v 1.23 2010/02/24 10:45:04 dkf Exp $ + * RCS: @(#) $Id: tclPipe.c,v 1.24 2010/06/14 12:58:13 nijtmans Exp $ */ #include "tclInt.h" @@ -275,7 +275,7 @@ TclCleanupChildren( int result = TCL_OK; int i, abnormalExit, anyErrorInfo; Tcl_Pid pid; - WAIT_STATUS_TYPE waitStatus; + int waitStatus; const char *msg; unsigned long resolvedPid; @@ -288,7 +288,7 @@ TclCleanupChildren( */ resolvedPid = TclpGetPid(pidPtr[i]); - pid = Tcl_WaitPid(pidPtr[i], (int *) &waitStatus, 0); + pid = Tcl_WaitPid(pidPtr[i], &waitStatus, 0); if (pid == (Tcl_Pid) -1) { result = TCL_ERROR; if (interp != NULL) { @@ -323,8 +323,7 @@ TclCleanupChildren( sprintf(msg1, "%lu", resolvedPid); if (WIFEXITED(waitStatus)) { if (interp != NULL) { - sprintf(msg2, "%lu", - (unsigned long) WEXITSTATUS(waitStatus)); + sprintf(msg2, "%u", WEXITSTATUS(waitStatus)); Tcl_SetErrorCode(interp, "CHILDSTATUS", msg1, msg2, NULL); } abnormalExit = 1; @@ -332,16 +331,14 @@ TclCleanupChildren( const char *p; if (WIFSIGNALED(waitStatus)) { - p = Tcl_SignalMsg((int) (WTERMSIG(waitStatus))); + p = Tcl_SignalMsg(WTERMSIG(waitStatus)); Tcl_SetErrorCode(interp, "CHILDKILLED", msg1, - Tcl_SignalId((int) (WTERMSIG(waitStatus))), p, - NULL); + Tcl_SignalId(WTERMSIG(waitStatus)), p, NULL); Tcl_AppendResult(interp, "child killed: ", p, "\n", NULL); } else if (WIFSTOPPED(waitStatus)) { - p = Tcl_SignalMsg((int) (WSTOPSIG(waitStatus))); + p = Tcl_SignalMsg(WSTOPSIG(waitStatus)); Tcl_SetErrorCode(interp, "CHILDSUSP", msg1, - Tcl_SignalId((int) (WSTOPSIG(waitStatus))), p, - NULL); + Tcl_SignalId(WSTOPSIG(waitStatus)), p, NULL); Tcl_AppendResult(interp, "child suspended: ", p, "\n", NULL); } else { diff --git a/unix/Makefile.in b/unix/Makefile.in index 1360908..46633b5 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -4,7 +4,7 @@ # "./configure", which is a configuration script generated by the "autoconf" # program (constructs like "@foo@" will get replaced in the actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.300 2010/06/09 20:11:34 andreas_kupries Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.301 2010/06/14 12:58:12 nijtmans Exp $ VERSION = @TCL_VERSION@ MAJOR_VERSION = @TCL_MAJOR_VERSION@ @@ -625,7 +625,8 @@ tclLibObjs: objs: ${OBJS} ${TCL_EXE}: ${TCLSH_OBJS} ${TCL_LIB_FILE} - ${CC} ${CFLAGS} ${LDFLAGS} ${TCLSH_OBJS} @TCL_BUILD_LIB_SPEC@ ${LIBS} @EXTRA_TCLSH_LIBS@ \ + ${CC} ${CFLAGS} ${LDFLAGS} ${TCLSH_OBJS} \ + @TCL_BUILD_LIB_SPEC@ ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -o ${TCL_EXE} # Must be empty so it doesn't conflict with rule for ${TCL_EXE} above @@ -677,7 +678,8 @@ ${TCLTEST_EXE}: ${TCLTEST_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} ${BUILD_DLT $(MAKE) tcltest-real LIB_RUNTIME_DIR="`pwd`" tcltest-real: - ${CC} ${CFLAGS} ${LDFLAGS} ${TCLTEST_OBJS} @TCL_BUILD_LIB_SPEC@ ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \ + ${CC} ${CFLAGS} ${LDFLAGS} ${TCLTEST_OBJS} \ + @TCL_BUILD_LIB_SPEC@ ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ ${CC_SEARCH_FLAGS} -o ${TCLTEST_EXE} # Note, in the targets below TCL_LIBRARY needs to be set or else "make test" @@ -1543,10 +1545,9 @@ $(DTRACE_OBJ): $(DTRACE_SRC) $(TCL_OBJS) # notifier can modify them to suit their own installation. #-------------------------------------------------------------------------- -xttest: ${XTTEST_OBJS} ${GENERIC_OBJS} ${UNIX_OBJS} ${COMPAT_OBJS} ${TCL_STUB_LIB_FILE} \ - @DL_OBJS@ ${BUILD_DLTEST} - ${CC} ${XTTEST_OBJS} ${GENERIC_OBJS} ${UNIX_OBJS} ${COMPAT_OBJS} ${TCL_STUB_LIB_FILE} \ - @DL_OBJS@ @TCL_BUILD_LIB_SPEC@ ${LIBS} \ +xttest: ${XTTEST_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} ${BUILD_DLTEST} + ${CC} ${CFLAGS} ${LDFLAGS} ${XTTEST_OBJS} \ + @TCL_BUILD_LIB_SPEC@ ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -L/usr/openwin/lib -lXt -o xttest tclXtNotify.o: $(UNIX_DIR)/tclXtNotify.c diff --git a/unix/tclXtNotify.c b/unix/tclXtNotify.c index c8c553d..ab82c58 100644 --- a/unix/tclXtNotify.c +++ b/unix/tclXtNotify.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: tclXtNotify.c,v 1.11 2009/11/18 23:46:05 nijtmans Exp $ + * RCS: @(#) $Id: tclXtNotify.c,v 1.12 2010/06/14 12:58:12 nijtmans Exp $ */ #ifndef USE_TCL_STUBS @@ -18,6 +18,9 @@ #include #include "tclInt.h" +#ifndef CONST86 +# define CONST86 +#endif /* * This structure is used to keep track of the notifier info for a a * registered file. @@ -79,22 +82,22 @@ static int initialized = 0; */ static int FileHandlerEventProc(Tcl_Event *evPtr, int flags); -static void FileProc(caddr_t clientData, int *source, +static void FileProc(ClientData clientData, int *source, XtInputId *id); -void InitNotifier(void); static void NotifierExitHandler(ClientData clientData); -static void TimerProc(caddr_t clientData, XtIntervalId *id); +static void TimerProc(ClientData clientData, XtIntervalId *id); static void CreateFileHandler(int fd, int mask, Tcl_FileProc * proc, ClientData clientData); static void DeleteFileHandler(int fd); -static void SetTimer(Tcl_Time * timePtr); -static int WaitForEvent(Tcl_Time * timePtr); +static void SetTimer(CONST86 Tcl_Time * timePtr); +static int WaitForEvent(CONST86 Tcl_Time * timePtr); /* * Functions defined in this file for use by users of the Xt Notifier: */ -EXTERN XtAppContext TclSetAppContext(XtAppContext ctx); +MODULE_SCOPE void InitNotifier(void); +MODULE_SCOPE XtAppContext TclSetAppContext(XtAppContext ctx); /* *---------------------------------------------------------------------- @@ -264,7 +267,7 @@ NotifierExitHandler( static void SetTimer( - Tcl_Time *timePtr) /* Timeout value, may be NULL. */ + CONST86 Tcl_Time *timePtr) /* Timeout value, may be NULL. */ { long timeout; @@ -303,7 +306,7 @@ SetTimer( static void TimerProc( - caddr_t data, /* Not used. */ + ClientData clientData, /* Not used. */ XtIntervalId *id) { if (*id != notifier.currentTimeout) { @@ -377,7 +380,7 @@ CreateFileHandler( if (mask & TCL_READABLE) { if (!(filePtr->mask & TCL_READABLE)) { filePtr->read = XtAppAddInput(notifier.appContext, fd, - XtInputReadMask, FileProc, filePtr); + INT2PTR(XtInputReadMask), FileProc, filePtr); } } else { if (filePtr->mask & TCL_READABLE) { @@ -387,7 +390,7 @@ CreateFileHandler( if (mask & TCL_WRITABLE) { if (!(filePtr->mask & TCL_WRITABLE)) { filePtr->write = XtAppAddInput(notifier.appContext, fd, - XtInputWriteMask, FileProc, filePtr); + INT2PTR(XtInputWriteMask), FileProc, filePtr); } } else { if (filePtr->mask & TCL_WRITABLE) { @@ -397,7 +400,7 @@ CreateFileHandler( if (mask & TCL_EXCEPTION) { if (!(filePtr->mask & TCL_EXCEPTION)) { filePtr->except = XtAppAddInput(notifier.appContext, fd, - XtInputExceptMask, FileProc, filePtr); + INT2PTR(XtInputExceptMask), FileProc, filePtr); } } else { if (filePtr->mask & TCL_EXCEPTION) { @@ -490,7 +493,7 @@ DeleteFileHandler( static void FileProc( - caddr_t clientData, + ClientData clientData, int *fd, XtInputId *id) { @@ -628,7 +631,7 @@ FileHandlerEventProc( static int WaitForEvent( - Tcl_Time *timePtr) /* Maximum block time, or NULL. */ + CONST86 Tcl_Time *timePtr) /* Maximum block time, or NULL. */ { int timeout; diff --git a/unix/tclXtTest.c b/unix/tclXtTest.c index d4bef9e..54bcbcf 100644 --- a/unix/tclXtTest.c +++ b/unix/tclXtTest.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: tclXtTest.c,v 1.10 2010/02/25 22:20:10 nijtmans Exp $ + * RCS: @(#) $Id: tclXtTest.c,v 1.11 2010/06/14 12:58:11 nijtmans Exp $ */ #ifndef USE_TCL_STUBS @@ -19,19 +19,13 @@ static int TesteventloopCmd(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); -extern void InitNotifier(void); - +extern DLLEXPORT Tcl_PackageInitProc Tclxttest_Init; /* - * TCL_STORAGE_CLASS is set unconditionally to DLLEXPORT because the - * Tcltest_Init declaration is in the source file itself, which is only - * accessed when we are building a library. + * Functions defined in tclXtNotify.c for use by users of the Xt Notifier: */ -#undef TCL_STORAGE_CLASS -#define TCL_STORAGE_CLASS DLLEXPORT -EXTERN int Tclxttest_Init(Tcl_Interp *interp); - - +extern void InitNotifier(void); +extern XtAppContext TclSetAppContext(XtAppContext ctx); /* *---------------------------------------------------------------------- -- cgit v0.12