diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2011-04-21 08:49:52 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2011-04-21 08:49:52 (GMT) |
commit | 4779fe18796c2f1adad2712560bc0cfe35e844be (patch) | |
tree | 170c82b377323ccaaa1d7543c9ca9c75ff3bf2c4 | |
parent | 2731caf0d3a265e5014fe123228eeaf50d418643 (diff) | |
parent | 96b29a9142faa15c73000f00d2eaa63fd0fb3054 (diff) | |
download | tcl-4779fe18796c2f1adad2712560bc0cfe35e844be.zip tcl-4779fe18796c2f1adad2712560bc0cfe35e844be.tar.gz tcl-4779fe18796c2f1adad2712560bc0cfe35e844be.tar.bz2 |
fix for [Bug 3288345]: Wrong Tcl_StatBufused on MinGW.
Make sure that all _WIN32 compilers use exactly the same layout
for Tcl_StatBuf - the one used by MSVC6 - in all situations.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | generic/tcl.h | 6 | ||||
-rwxr-xr-x | win/configure | 69 | ||||
-rw-r--r-- | win/configure.in | 19 | ||||
-rw-r--r-- | win/tclWinPort.h | 19 |
5 files changed, 119 insertions, 6 deletions
@@ -1,3 +1,11 @@ +2011-04-21 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tcl.h: fix for [Bug 3288345]: Wrong Tcl_StatBuf + * generic/tclInt.h: used on MinGW. Make sure that all _WIN32 + * win/tclWinFile.c: compilers use exactly the same layout + * win/configure.in: for Tcl_StatBuf - the one used by MSVC6 - + * win/configure: in all situations. + 2011-04-19 Don Porter <dgp@users.sourceforge.net> * generic/tclConfig.c: Reduce internals access in the implementation @@ -18,10 +26,6 @@ * doc/dict.n: [Bug 3288696]: Command summary was confusingly wrong when it came to [dict filter] with a 'value' filter. -2011-04-18 Jan Nijtmans <nijtmans@users.sf.net> - - * generic/tcl.h: [Bug 3288345]: Fix wrong Tcl_StatBuf used on MinGW. - 2011-04-16 Donal K. Fellows <dkf@users.sf.net> * generic/tclFCmd.c (TclFileAttrsCmd): Add comments to make this code diff --git a/generic/tcl.h b/generic/tcl.h index 5e82432..73a8932 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -379,10 +379,12 @@ typedef long LONG; typedef struct stati64 Tcl_StatBuf; # define TCL_LL_MODIFIER "L" # else /* __BORLANDC__ */ -# if (defined(_MSC_VER) && (_MSC_VER < 1400)) || !defined(_M_IX86) || defined(__GNUC__) +# if defined(_WIN64) +typedef struct _stat64 Tcl_StatBuf; +# elif (defined(_MSC_VER) && (_MSC_VER < 1400)) typedef struct _stati64 Tcl_StatBuf; # else -typedef struct _stat64 Tcl_StatBuf; +typedef struct _stat32i64 Tcl_StatBuf; # endif /* _MSC_VER < 1400 */ # define TCL_LL_MODIFIER "I64" # endif /* __BORLANDC__ */ diff --git a/win/configure b/win/configure index ecfd2ec..9a62942 100755 --- a/win/configure +++ b/win/configure @@ -3483,6 +3483,75 @@ _ACEOF fi +# Check to see if struct _stat32i64 exists in mingw's sys/stat.h + +echo "$as_me:$LINENO: checking struct _stat32i64" >&5 +echo $ECHO_N "checking struct _stat32i64... $ECHO_C" >&6 +if test "${tcl_struct_stat32i64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <sys/types.h> +#include <sys/stat.h> + +int +main () +{ + + struct _stat32i64 foo; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_struct_stat32i64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_struct_stat32i64=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $tcl_struct_stat32i64" >&5 +echo "${ECHO_T}$tcl_struct_stat32i64" >&6 +if test "$tcl_struct_stat32i64" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STRUCT_STAT32I64 1 +_ACEOF + +fi + # See if declarations like FINDEX_INFO_LEVELS are # missing from winbase.h. This is known to be diff --git a/win/configure.in b/win/configure.in index 54727f8..7d43a38 100644 --- a/win/configure.in +++ b/win/configure.in @@ -225,6 +225,25 @@ if test "$tcl_cv_cast_to_union" = "yes"; then [Defined when compiler supports casting to union type.]) fi +# Check to see if struct _stat32i64 exists in mingw's sys/stat.h + +AC_CACHE_CHECK(struct _stat32i64, + tcl_struct_stat32i64, +AC_TRY_COMPILE([ +#include <sys/types.h> +#include <sys/stat.h> +], +[ + struct _stat32i64 foo; +], + tcl_struct_stat32i64=yes, + tcl_struct_stat32i64=no) +) +if test "$tcl_struct_stat32i64" = "yes" ; then + AC_DEFINE(HAVE_STRUCT_STAT32I64, 1, + [Defined when sys/stat.h has struct_stat32i64]) +fi + # See if declarations like FINDEX_INFO_LEVELS are # missing from winbase.h. This is known to be diff --git a/win/tclWinPort.h b/win/tclWinPort.h index f7e16a2..9c9831c 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -113,6 +113,25 @@ #include <time.h> /* + * Not all mingw32 versions have this struct. + */ +#if !defined(__BORLANDC__) && !defined(_MSC_VER) && !defined(_WIN64) && !defined(HAVE_STRUCT_STAT32I64) + struct _stat32i64 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + long st_atime; + long st_mtime; + long st_ctime; + }; +#endif + +/* * The following defines redefine the Windows Socket errors as * BSD errors so Tcl_PosixError can do the right thing. */ |