Tcl Source Code

Check-in [7fd2f5f049]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fix for [Bug 3288345]: Wrong Tcl_StatBuf used on MinGW. Make sure that all _WIN32 compilers use exactly the same layout for Tcl_StatBuf - the one used by MSVC6 - in all situations.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1: 7fd2f5f049b7a86e52c48fdb0aade75418cca77d
User & Date: jan.nijtmans 2011-04-21 08:27:52
Context
2011-04-21
12:07
merge-mark check-in: d6aef45cc4 user: jan.nijtmans tags: core-8-5-branch
08:49
fix for [Bug 3288345]: Wrong Tcl_StatBufused on MinGW. Make sure that all _WIN32 compilers use exact... check-in: ac3601bf0c user: jan.nijtmans tags: trunk
08:27
fix for [Bug 3288345]: Wrong Tcl_StatBuf used on MinGW. Make sure that all _WIN32 compilers use exac... check-in: 7fd2f5f049 user: jan.nijtmans tags: core-8-5-branch
08:08
fix for [Bug 3288345]: Wrong Tcl_StatBufused on MinGW. Make sure that all _WIN32 compilers use exact... check-in: 85f64af9fd user: jan.nijtmans tags: core-8-4-branch
2011-04-20
22:05
Support cross-compilation to x64 from ix86 hosts when using NMAKE.

Part of the build uses tclsh to ... check-in: c8fe7da5db user: patthoyts tags: core-8-5-branch

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.









1
2
3
4
5
6
7








2011-04-20  Andreas Kupries  <[email protected]>

	* generic/tclFCmd.c (TclFileAttrsCmd): Added commands to reset the
	typePtr of the Tcl_Obj* whose int-rep was just purged. Required to
	prevent a dangling IndexRep* to reused, smashing the heap. See
	also the entries at 2011-04-16 and 2011-03-24 for the history of
	the problem.
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2011-04-21  Jan Nijtmans  <[email protected]>

	* 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-20  Andreas Kupries  <[email protected]>

	* generic/tclFCmd.c (TclFileAttrsCmd): Added commands to reset the
	typePtr of the Tcl_Obj* whose int-rep was just purged. Required to
	prevent a dangling IndexRep* to reused, smashing the heap. See
	also the entries at 2011-04-16 and 2011-03-24 for the history of
	the problem.
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
	* generic/tclConfig.c:
	* generic/tclListObj.c:

	* generic/tclInt.h:	Define and use macros that test whether
	* generic/tclBasic.c:	a Tcl list value is canonical.
	* generic/tclUtil.c:

2011-04-18  Jan Nijtmans  <[email protected]>

	* generic/tcl.h: fix for [Bug 3288345]: Wrong Tcl_StatBuf
	used on MinGW.

2011-04-16  Donal K. Fellows  <[email protected]>

	* generic/tclFCmd.c (TclFileAttrsCmd): Tidied up the memory management
	a bit to try to ensure that the dynamic and static cases don't get
	confused while still promoting caching where possible. Added a panic
	to trap problems in the case where an extension is misusing the API.








<
<
<
<
<







25
26
27
28
29
30
31





32
33
34
35
36
37
38
	* generic/tclConfig.c:
	* generic/tclListObj.c:

	* generic/tclInt.h:	Define and use macros that test whether
	* generic/tclBasic.c:	a Tcl list value is canonical.
	* generic/tclUtil.c:






2011-04-16  Donal K. Fellows  <[email protected]>

	* generic/tclFCmd.c (TclFileAttrsCmd): Tidied up the memory management
	a bit to try to ensure that the dynamic and static cases don't get
	confused while still promoting caching where possible. Added a panic
	to trap problems in the case where an extension is misusing the API.

Changes to generic/tcl.h.

354
355
356
357
358
359
360


361
362
363
364
365
366
367
368
369
370
371
#if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG)
#   if defined(__WIN32__)
#      define TCL_WIDE_INT_TYPE __int64
#      ifdef __BORLANDC__
typedef struct stati64 Tcl_StatBuf;
#         define TCL_LL_MODIFIER	"L"
#      else /* __BORLANDC__ */


#         if (defined(_MSC_VER) && (_MSC_VER < 1400)) || !defined(_M_IX86) || defined(__GNUC__)
typedef struct _stati64	Tcl_StatBuf;
#         else
typedef struct _stat64	Tcl_StatBuf;
#         endif /* _MSC_VER < 1400 */
#         define TCL_LL_MODIFIER	"I64"
#      endif /* __BORLANDC__ */
#   elif defined(__GNUC__)
#      define TCL_WIDE_INT_TYPE long long
#      define TCL_LL_MODIFIER	"ll"
typedef struct stat	Tcl_StatBuf;







>
>
|


|







354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
#if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG)
#   if defined(__WIN32__)
#      define TCL_WIDE_INT_TYPE __int64
#      ifdef __BORLANDC__
typedef struct stati64 Tcl_StatBuf;
#         define TCL_LL_MODIFIER	"L"
#      else /* __BORLANDC__ */
#         if defined(_WIN64)
typedef struct _stat64 Tcl_StatBuf;
#         elif (defined(_MSC_VER) && (_MSC_VER < 1400))
typedef struct _stati64	Tcl_StatBuf;
#         else
typedef struct _stat32i64 Tcl_StatBuf;
#         endif /* _MSC_VER < 1400 */
#         define TCL_LL_MODIFIER	"I64"
#      endif /* __BORLANDC__ */
#   elif defined(__GNUC__)
#      define TCL_WIDE_INT_TYPE long long
#      define TCL_LL_MODIFIER	"ll"
typedef struct stat	Tcl_StatBuf;

Changes to win/configure.

3544
3545
3546
3547
3548
3549
3550





































































3551
3552
3553
3554
3555
3556
3557
echo "${ECHO_T}$tcl_cv_cast_to_union" >&6
if test "$tcl_cv_cast_to_union" = "yes"; then

cat >>confdefs.h <<\_ACEOF
#define HAVE_CAST_TO_UNION 1
_ACEOF






































































fi


# See if declarations like FINDEX_INFO_LEVELS are
# missing from winbase.h. This is known to be
# a problem with VC++ 5.2.








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
echo "${ECHO_T}$tcl_cv_cast_to_union" >&6
if test "$tcl_cv_cast_to_union" = "yes"; then

cat >>confdefs.h <<\_ACEOF
#define HAVE_CAST_TO_UNION 1
_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
# a problem with VC++ 5.2.

Changes to win/configure.in.

236
237
238
239
240
241
242



















243
244
245
246
247
248
249
        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





















# See if declarations like FINDEX_INFO_LEVELS are
# missing from winbase.h. This is known to be
# a problem with VC++ 5.2.

AC_CACHE_CHECK(for FINDEX_INFO_LEVELS in winbase.h,







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
        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

# 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
# a problem with VC++ 5.2.

AC_CACHE_CHECK(for FINDEX_INFO_LEVELS in winbase.h,

Changes to win/tclWinPort.h.

100
101
102
103
104
105
106



















107
108
109
110
111
112
113
 * If ENOTSUP is not defined, define it to a value that will never occur.
 */

#ifndef ENOTSUP
#   define ENOTSUP	-1030507
#endif




















/*
 * The following defines redefine the Windows Socket errors as
 * BSD errors so Tcl_PosixError can do the right thing.
 */

#ifndef EWOULDBLOCK
#   define EWOULDBLOCK	EAGAIN







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
 * If ENOTSUP is not defined, define it to a value that will never occur.
 */

#ifndef ENOTSUP
#   define ENOTSUP	-1030507
#endif

/*
 * 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.
 */

#ifndef EWOULDBLOCK
#   define EWOULDBLOCK	EAGAIN