From 60b96992277a21af6c79074d66edf3a069abf734 Mon Sep 17 00:00:00 2001 From: mdejong Date: Mon, 27 Jan 2003 02:19:55 +0000 Subject: * win/configure: Regen. * win/configure.in: Add test that checks to see if the compiler can cast to a union type. * win/tclWinTime.c: Squelch compiler warning about union initializer by casting to union type when compiling with gcc. --- ChangeLog | 9 ++++++ win/configure | 92 +++++++++++++++++++++++++++++++++++++++++--------------- win/configure.in | 22 +++++++++++++- win/tclWinTime.c | 28 ++++++++++------- 4 files changed, 114 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index 44b0223..b5e5d5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2003-01-26 Mo DeJong + + * win/configure: Regen. + * win/configure.in: Add test that checks to + see if the compiler can cast to a union type. + * win/tclWinTime.c: Squelch compiler warning + about union initializer by casting to union + type when compiling with gcc. + 2003-01-25 Mo DeJong * generic/tclIO.c (Tcl_CutChannel, Tcl_SpliceChannel): diff --git a/win/configure b/win/configure index a5d5bdc..064db16 100755 --- a/win/configure +++ b/win/configure @@ -1219,18 +1219,60 @@ EOF fi +# See if the compiler supports casting to a union type. +# This is used to stop gcc from printing a compiler +# warning when initializing a union member. + +echo $ac_n "checking for cast to union support""... $ac_c" 1>&6 +echo "configure:1228: checking for cast to union support" >&5 +if eval "test \"`echo '$''{'tcl_cv_cast_to_union'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + tcl_cv_cast_to_union=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + tcl_cv_cast_to_union=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$tcl_cv_cast_to_union" 1>&6 +if test "$tcl_cv_cast_to_union" = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_CAST_TO_UNION 1 +EOF + +fi + + #-------------------------------------------------------------------- # Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1228: checking for object suffix" >&5 +echo "configure:1270: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1234: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1276: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -1248,19 +1290,19 @@ OBJEXT=$ac_cv_objext ac_objext=$ac_cv_objext echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:1252: checking for mingw32 environment" >&5 +echo "configure:1294: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1306: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -1279,7 +1321,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1283: checking for executable suffix" >&5 +echo "configure:1325: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1289,7 +1331,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -1316,7 +1358,7 @@ ac_exeext=$EXEEXT echo $ac_n "checking for building with threads""... $ac_c" 1>&6 -echo "configure:1320: checking for building with threads" >&5 +echo "configure:1362: checking for building with threads" >&5 # Check whether --enable-threads or --disable-threads was given. if test "${enable_threads+set}" = set; then enableval="$enable_threads" @@ -1353,7 +1395,7 @@ EOF echo $ac_n "checking how to build libraries""... $ac_c" 1>&6 -echo "configure:1357: checking how to build libraries" >&5 +echo "configure:1399: checking how to build libraries" >&5 # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" @@ -1394,7 +1436,7 @@ EOF # Step 0: Enable 64 bit support? echo $ac_n "checking if 64bit support is requested""... $ac_c" 1>&6 -echo "configure:1398: checking if 64bit support is requested" >&5 +echo "configure:1440: checking if 64bit support is requested" >&5 # Check whether --enable-64bit or --disable-64bit was given. if test "${enable_64bit+set}" = set; then enableval="$enable_64bit" @@ -1411,7 +1453,7 @@ fi # Extract the first word of "cygpath", so it can be a program name with args. set dummy cygpath; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1415: checking for $ac_word" >&5 +echo "configure:1457: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CYGPATH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1455,9 +1497,9 @@ fi echo "END" >> $conftest echo $ac_n "checking for Windows native path bug in windres""... $ac_c" 1>&6 -echo "configure:1459: checking for Windows native path bug in windres" >&5 +echo "configure:1501: checking for Windows native path bug in windres" >&5 cyg_conftest=`$CYGPATH $conftest` - if { ac_try='$RC -o conftest.res.o $cyg_conftest'; { (eval echo configure:1461: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } ; then + if { ac_try='$RC -o conftest.res.o $cyg_conftest'; { (eval echo configure:1503: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } ; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 @@ -1476,7 +1518,7 @@ echo "configure:1459: checking for Windows native path bug in windres" >&5 # set various compiler flags depending on whether we are using gcc or cl echo $ac_n "checking compiler flags""... $ac_c" 1>&6 -echo "configure:1480: checking compiler flags" >&5 +echo "configure:1522: checking compiler flags" >&5 if test "${GCC}" = "yes" ; then if test "$do64bit" = "yes" ; then echo "configure: warning: "64bit mode not supported with GCC on Windows"" 1>&2 @@ -1692,7 +1734,7 @@ echo "configure:1480: checking compiler flags" >&5 echo $ac_n "checking for build with symbols""... $ac_c" 1>&6 -echo "configure:1696: checking for build with symbols" >&5 +echo "configure:1738: checking for build with symbols" >&5 # Check whether --enable-symbols or --disable-symbols was given. if test "${enable_symbols+set}" = set; then enableval="$enable_symbols" @@ -1752,7 +1794,7 @@ TCL_DBGX=${DBGX} #-------------------------------------------------------------------- echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1756: checking how to run the C preprocessor" >&5 +echo "configure:1798: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1767,13 +1809,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1777: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1819: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1784,13 +1826,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1794: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1801,13 +1843,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1833,17 +1875,17 @@ echo "$ac_t""$CPP" 1>&6 ac_safe=`echo "errno.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for errno.h""... $ac_c" 1>&6 -echo "configure:1837: checking for errno.h" >&5 +echo "configure:1879: checking for errno.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1847: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1889: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* diff --git a/win/configure.in b/win/configure.in index 16591e6..b195e2b 100644 --- a/win/configure.in +++ b/win/configure.in @@ -3,7 +3,7 @@ # generate the file "configure", which is run during Tcl installation # to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.64 2003/01/25 12:48:12 mdejong Exp $ +# RCS: @(#) $Id: configure.in,v 1.65 2003/01/27 02:19:57 mdejong Exp $ AC_INIT(../generic/tcl.h) AC_PREREQ(2.13) @@ -224,6 +224,26 @@ if test "$tcl_cv_malloc_decl_alloca" = "no" && [Defined when gcc should use inline ASM to call alloca.]) fi +# See if the compiler supports casting to a union type. +# This is used to stop gcc from printing a compiler +# warning when initializing a union member. + +AC_CACHE_CHECK(for cast to union support, + tcl_cv_cast_to_union, +AC_TRY_COMPILE([], +[ + union foo { int i; double d; }; + union foo f = (union foo) (int) 0; +], + tcl_cv_cast_to_union=yes, + tcl_cv_cast_to_union=no) +) +if test "$tcl_cv_cast_to_union" = "yes"; then + AC_DEFINE(HAVE_CAST_TO_UNION, 1, + [Defined when compiler supports casting to union type.]) +fi + + #-------------------------------------------------------------------- # Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 13d1a4e..70ab93d 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.12 2002/11/26 22:35:21 davygrvy Exp $ + * RCS: @(#) $Id: tclWinTime.c,v 1.13 2003/01/27 02:19:57 mdejong Exp $ */ #include "tclWinInt.h" @@ -99,16 +99,22 @@ typedef struct TimeInfo { } TimeInfo; static TimeInfo timeInfo = { - { NULL }, - 0, - 0, - (HANDLE) NULL, - (HANDLE) NULL, - (HANDLE) NULL, - 0, - 0, - 0, - 0, + { NULL }, + 0, + 0, + (HANDLE) NULL, + (HANDLE) NULL, + (HANDLE) NULL, +#ifdef HAVE_CAST_TO_UNION + (ULARGE_INTEGER) (DWORDLONG) 0, + (LARGE_INTEGER) (LONGLONG) 0, + (LARGE_INTEGER) (LONGLONG) 0, +#else + 0, + 0, + 0, +#endif + 0, 0, 0 }; -- cgit v0.12