From ee2c8b324fa577fbacf55ec66e2f51d8eec04ef0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 16 Dec 2020 15:32:20 +0000 Subject: TIP #592 implementation: Stop support for Windows XP, Server 2003, Vista, Server 2008 --- win/tclWin32Dll.c | 6 +++--- win/tclWinFile.c | 7 +------ win/tclWinInit.c | 17 ----------------- win/tclWinInt.h | 10 ---------- win/tclWinPipe.c | 4 +--- win/tclWinPort.h | 6 +++--- 6 files changed, 8 insertions(+), 42 deletions(-) diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index cb9f8c8..cbcb3ed 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -185,12 +185,12 @@ TclWinInit( GetVersionExW(&os); /* - * We no longer support Win32s or Win9x or Windows CE, so just in case - * someone manages to get a runtime there, make sure they know that. + * We no longer support Win32s or Win9x or Windows CE or Windows XP, so just + * in case someone manages to get a runtime there, make sure they know that. */ if (os.dwPlatformId != VER_PLATFORM_WIN32_NT) { - Tcl_Panic("Windows NT is the only supported platform"); + Tcl_Panic("Windows 7 is the minimum supported platform"); } } diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 38edd87..728f675 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -264,12 +264,7 @@ WinLink( TclWinConvertError(GetLastError()); } else if (linkAction & TCL_CREATE_SYMBOLIC_LINK) { - if (!tclWinProcs.createSymbolicLink) { - /* - * Can't symlink files. - */ - Tcl_SetErrno(ENOTDIR); - } else if (tclWinProcs.createSymbolicLink(linkSourcePath, linkTargetPath, + if (CreateSymbolicLinkW(linkSourcePath, linkTargetPath, 0x2 /* SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE */)) { /* * Success! diff --git a/win/tclWinInit.c b/win/tclWinInit.c index a7fb8d0..fe58b4c 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -78,11 +78,6 @@ typedef struct { /* - * Windows version dependend functions - */ -TclWinProcs tclWinProcs; - -/* * The following arrays contain the human readable strings for the * processor values. */ @@ -131,7 +126,6 @@ TclpInitPlatform(void) { WSADATA wsaData; WORD wVersionRequested = MAKEWORD(2, 2); - HMODULE handle; tclPlatform = TCL_PLATFORM_WINDOWS; @@ -150,17 +144,6 @@ TclpInitPlatform(void) TclWinInit(GetModuleHandleW(NULL)); #endif - - /* - * Fill available functions depending on windows version - */ - handle = GetModuleHandleW(L"KERNEL32"); - tclWinProcs.cancelSynchronousIo = - (BOOL (WINAPI *)(HANDLE))(void *)GetProcAddress(handle, - "CancelSynchronousIo"); - tclWinProcs.createSymbolicLink = - (BOOLEAN (WINAPI *)(LPCWSTR, LPCWSTR, DWORD))(void *)GetProcAddress(handle, - "CreateSymbolicLinkW"); } /* diff --git a/win/tclWinInt.h b/win/tclWinInt.h index 90a6cea..52a9522 100644 --- a/win/tclWinInt.h +++ b/win/tclWinInt.h @@ -32,16 +32,6 @@ typedef struct TCLEXCEPTION_REGISTRATION { #endif /* - * Windows version dependend functions - */ -typedef struct TclWinProcs { - BOOL (WINAPI *cancelSynchronousIo)(HANDLE); - BOOLEAN (WINAPI *createSymbolicLink)(LPCWSTR, LPCWSTR, DWORD); -} TclWinProcs; - -MODULE_SCOPE TclWinProcs tclWinProcs; - -/* * Declarations of functions that are not accessible by way of the * stubs table. */ diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 6a9d9a9..90ac9ef 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -3574,9 +3574,7 @@ TclPipeThreadStop( * Cancel all sync-IO of this thread (may be blocked there). */ - if (tclWinProcs.cancelSynchronousIo) { - tclWinProcs.cancelSynchronousIo(hThread); - } + CancelSynchronousIo(hThread); /* * Wait at most 20 milliseconds for the reader thread to close diff --git a/win/tclWinPort.h b/win/tclWinPort.h index 94c8e87..2c52b73 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -26,14 +26,14 @@ /* * We must specify the lower version we intend to support. * - * WINVER = 0x0501 means Windows XP and above + * WINVER = 0x0601 means Windows 7 and above */ #ifndef WINVER -# define WINVER 0x0501 +# define WINVER 0x0601 #endif #ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0501 +# define _WIN32_WINNT 0x0601 #endif #define WIN32_LEAN_AND_MEAN -- cgit v0.12 From 4855172d084e45d52616436e03814adf900aeb89 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 16 Dec 2020 15:46:04 +0000 Subject: Remove "Vista" from manifest. Test simplifications --- tests/fCmd.test | 59 +++++------------------------------------------ tests/winFCmd.test | 43 ++++------------------------------ win/tclsh.exe.manifest.in | 2 -- 3 files changed, 11 insertions(+), 93 deletions(-) diff --git a/tests/fCmd.test b/tests/fCmd.test index 004392f..5b70c81 100644 --- a/tests/fCmd.test +++ b/tests/fCmd.test @@ -22,8 +22,6 @@ cd [temporaryDirectory] testConstraint testsetplatform [llength [info commands testsetplatform]] testConstraint testchmod [llength [info commands testchmod]] -testConstraint winVista 0 -testConstraint winXP 0 testConstraint win10 0 # Don't know how to determine this constraint correctly testConstraint notNetworkFilesystem 0 @@ -65,18 +63,8 @@ if {[testConstraint unix]} { } } -# Also used in winFCmd... -if {[testConstraint win]} { - if {$::tcl_platform(osVersion) >= 5.0} { - if {$::tcl_platform(osVersion) >= 10.0} { - testConstraint win10 1 - } - if {$::tcl_platform(osVersion) >= 6.0} { - testConstraint winVista 1 - } else { - testConstraint win2000orXP 1 - } - } +if {[testConstraint win] && $::tcl_platform(osVersion) >= 10.0} { + testConstraint win10 1 } testConstraint darwin9 [expr { @@ -795,18 +783,7 @@ test fCmd-9.3 {file rename: comprehensive: file to new name} -setup { file rename tf2 tf4 list [lsort [glob tf*]] [file writable tf3] [file writable tf4] } -result {{tf3 tf4} 1 0} -test fCmd-9.4.a {file rename: comprehensive: dir to new name} -setup { - cleanup -} -constraints {win winXP testchmod} -body { - file mkdir td1 td2 - testchmod 0o555 td2 - file rename td1 td3 - file rename td2 td4 - list [lsort [glob td*]] [file writable td3] [file writable td4] -} -cleanup { - cleanup -} -result {{td3 td4} 1 0} -test fCmd-9.4.b {file rename: comprehensive: dir to new name} -setup { +test fCmd-9.4 {file rename: comprehensive: dir to new name} -setup { cleanup } -constraints {unix notRoot testchmod notDarwin9} -body { file mkdir td1 td2 @@ -827,17 +804,7 @@ test fCmd-9.5 {file rename: comprehensive: file to self} -setup { file rename -force tf2 tf2 list [contents tf1] [contents tf2] [file writable tf1] [file writable tf2] } -result {tf1 tf2 1 0} -test fCmd-9.6.a {file rename: comprehensive: dir to self} -setup { - cleanup -} -constraints {win winXP testchmod} -body { - file mkdir td1 - file mkdir td2 - testchmod 0o555 td2 - file rename -force td1 . - file rename -force td2 . - list [lsort [glob td*]] [file writable td1] [file writable td2] -} -result {{td1 td2} 1 0} -test fCmd-9.6.b {file rename: comprehensive: dir to self} -setup { +test fCmd-9.6 {file rename: comprehensive: dir to self} -setup { cleanup } -constraints {unix notRoot testchmod} -body { file mkdir td1 @@ -915,16 +882,9 @@ test fCmd-9.9 {file rename: comprehensive: dir to non-empty dir} -setup { file mkdir tds2 file mkdir [file join tdd1 tds1 xxx] file mkdir [file join tdd2 tds2 xxx] - if {!([testConstraint unix] || [testConstraint winVista])} { - testchmod 0o555 tds2 - } set a1 [list [catch {file rename -force tds1 tdd1} msg] $msg] set a2 [list [catch {file rename -force tds2 tdd2} msg] $msg] - if {[testConstraint unix] || [testConstraint winVista]} { - set w2 0 - } else { - set w2 [file writable tds2] - } + set w2 0 list [lsort [glob td*]] $a1 $a2 [file writable tds1] $w2 } -match glob -result \ [subst {{tdd1 tdd2 tds1 tds2} {1 {error renaming "tds1" to "[file join tdd1 tds1]": file *}} {1 {error renaming "tds2" to "[file join tdd2 tds2]": file *}} 1 0}] @@ -946,16 +906,9 @@ test fCmd-9.11 {file rename: comprehensive: dir to new name and dir} -setup { file mkdir td1 file mkdir td2 file mkdir td3 - if {!([testConstraint unix] || [testConstraint winVista])} { - testchmod 0o555 td2 - } file rename td1 [file join td3 td3] file rename td2 [file join td3 td4] - if {[testConstraint unix] || [testConstraint winVista]} { - set w4 0 - } else { - set w4 [file writable [file join td3 td4]] - } + set w4 0 list [lsort [glob td*]] [lsort [glob -directory td3 t*]] \ [file writable [file join td3 td3]] $w4 } -result [subst {td3 {[file join td3 td3] [file join td3 td4]} 1 0}] diff --git a/tests/winFCmd.test b/tests/winFCmd.test index c60952a..d118725 100644 --- a/tests/winFCmd.test +++ b/tests/winFCmd.test @@ -20,8 +20,6 @@ catch [list package require -exact tcl::test [info patchlevel]] # Initialise the test constraints -testConstraint winVista 0 -testConstraint winXP 0 testConstraint testvolumetype [llength [info commands testvolumetype]] testConstraint testfile [llength [info commands testfile]] testConstraint testchmod [llength [info commands testchmod]] @@ -59,14 +57,6 @@ proc cleanup {args} { } } -if {[testConstraint win]} { - if {$::tcl_platform(osVersion) >= 5.0} { - testConstraint winVista 1 - } else { - testConstraint winXP 1 - } -} - # find a CD-ROM so we can test read-only filesystems. proc findfile {dir} { @@ -206,11 +196,6 @@ test winFCmd-1.12 {TclpRenameFile: errno: EACCES} -setup { } -cleanup { catch {close $fd} } -returnCodes error -result EACCES -test winFCmd-1.13 {TclpRenameFile: errno: EACCES} -setup { - cleanup -} -constraints {win winXP testfile} -body { - testfile mv nul tf1 -} -returnCodes error -result EINVAL test winFCmd-1.15 {TclpRenameFile: errno: EEXIST} -setup { cleanup } -constraints {win testfile} -body { @@ -234,11 +219,6 @@ test winFCmd-1.18 {TclpRenameFile: srcAttr == -1} -setup { } -constraints {win testfile} -body { testfile mv tf1 tf2 } -returnCodes error -result ENOENT -test winFCmd-1.19 {TclpRenameFile: errno == EACCES} -setup { - cleanup -} -constraints {win winXP testfile} -body { - testfile mv nul tf1 -} -returnCodes error -result EINVAL test winFCmd-1.20 {TclpRenameFile: src is dir} -setup { cleanup } -constraints {win testfile} -body { @@ -447,11 +427,6 @@ test winFCmd-2.6 {TclpCopyFile: errno: ENOENT} -setup { } -cleanup { cleanup } -returnCodes error -result ENOENT -test winFCmd-2.7 {TclpCopyFile: errno: EACCES} -setup { - cleanup -} -constraints {win winXP testfile} -body { - testfile cp nul tf1 -} -returnCodes error -result EINVAL test winFCmd-2.10 {TclpCopyFile: CopyFile succeeds} -setup { cleanup } -constraints {win testfile} -body { @@ -642,7 +617,7 @@ test winFCmd-5.1 {TclpCopyDirectory: calls TraverseWinTree} -setup { test winFCmd-6.1 {TclpRemoveDirectory: errno: EACCES} -setup { cleanup -} -constraints {winVista testfile testchmod knownMsvcBug notInCIenv} -body { +} -constraints {win testfile testchmod knownMsvcBug notInCIenv} -body { file mkdir td1 testchmod 0 td1 testfile rmdir td1 @@ -696,7 +671,7 @@ test winFCmd-6.8 {TclpRemoveDirectory: RemoveDirectory fails} -setup { } -result {1 {tf1 ENOTDIR}} test winFCmd-6.9 {TclpRemoveDirectory: errno == EACCES} -setup { cleanup -} -constraints {winVista testfile testchmod knownMsvcBug notInCIenv} -body { +} -constraints {win testfile testchmod knownMsvcBug notInCIenv} -body { file mkdir td1 testchmod 0 td1 testfile rmdir td1 @@ -714,7 +689,7 @@ test winFCmd-6.11 {TclpRemoveDirectory: attr == -1} -setup { } -returnCodes error -match regexp -result {^/ E(ACCES|EXIST)$} test winFCmd-6.13 {TclpRemoveDirectory: write-protected} -setup { cleanup -} -constraints {winVista testfile testchmod knownMsvcBug notInCIenv} -body { +} -constraints {win testfile testchmod knownMsvcBug notInCIenv} -body { file mkdir td1 testchmod 0 td1 testfile rmdir td1 @@ -943,7 +918,7 @@ test winFCmd-9.1 {TraversalDelete: DOTREE_F} -setup { } -result {} test winFCmd-9.3 {TraversalDelete: DOTREE_PRED} -setup { cleanup -} -constraints {winVista testfile testchmod knownMsvcBug notInCIenv} -body { +} -constraints {win testfile testchmod knownMsvcBug notInCIenv} -body { file mkdir td1/td2 testchmod 0 td1 testfile rmdir -force td1 @@ -1056,15 +1031,7 @@ test winFCmd-12.4 {ConvertFileNameFormat} -constraints {win} -setup { test winFCmd-12.5 {ConvertFileNameFormat: absolute path} -body { list [file attributes / -longname] [file attributes \\ -longname] } -constraints {win} -result {/ /} -test winFCmd-12.6 {ConvertFileNameFormat: absolute path with drive} -setup { - catch {file delete -force -- c:/TclTmpC.1} -} -constraints {win winXP} -body { - createfile c:/TclTmpC.1 {} - string tolower [file attributes c:/TclTmpC.1 -longname] -} -cleanup { - file delete -force -- c:/TclTmpC.1 -} -result [string tolower {c:/TclTmpC.1}] -test winFCmd-12.6.2 {ConvertFileNameFormat: absolute path with drive (in temp folder)} -setup { +test winFCmd-12.6 {ConvertFileNameFormat: absolute path with drive (in temp folder)} -setup { catch {file delete -force -- $::env(TEMP)/td1} } -constraints {win} -body { createfile $::env(TEMP)/td1 {} diff --git a/win/tclsh.exe.manifest.in b/win/tclsh.exe.manifest.in index 8b06fce..dd8a7c5 100644 --- a/win/tclsh.exe.manifest.in +++ b/win/tclsh.exe.manifest.in @@ -28,8 +28,6 @@ - - -- cgit v0.12 From c5500b60350f48a5de2b1217fa38cc678511a329 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 17 Dec 2020 15:44:01 +0000 Subject: Simplifications when assuming VS 2015 or later --- generic/tcl.h | 2 +- generic/tclCmdMZ.c | 14 +++++++------- generic/tclInt.h | 7 ------- generic/tclMain.c | 5 ----- generic/tclThreadTest.c | 2 +- win/nmakehlp.c | 9 --------- win/tclWin32Dll.c | 8 -------- win/tclWinPort.h | 16 +++------------- 8 files changed, 12 insertions(+), 51 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 72f9bed..e0bc708 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -361,7 +361,7 @@ typedef long LONG; #if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG) # if defined(_WIN32) && (!defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO) -# define TCL_WIDE_INT_TYPE __int64 +# define TCL_WIDE_INT_TYPE long long # define TCL_LL_MODIFIER "I64" # if defined(_WIN64) # define TCL_Z_MODIFIER "I" diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 3906810..d020a93 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -4148,14 +4148,14 @@ Tcl_TimeRateObjCmd( Tcl_Obj *objPtr; int result, i; Tcl_Obj *calibrate = NULL, *direct = NULL; - TclWideMUInt count = 0; /* Holds repetition count */ + Tcl_WideUInt count = 0; /* Holds repetition count */ Tcl_WideInt maxms = WIDE_MIN; /* Maximal running time (in milliseconds) */ - TclWideMUInt maxcnt = WIDE_MAX; + Tcl_WideUInt maxcnt = WIDE_MAX; /* Maximal count of iterations. */ - TclWideMUInt threshold = 1; /* Current threshold for check time (faster + Tcl_WideUInt threshold = 1; /* Current threshold for check time (faster * repeat count without time check) */ - TclWideMUInt maxIterTm = 1; /* Max time of some iteration as max + Tcl_WideUInt maxIterTm = 1; /* Max time of some iteration as max * threshold, additionally avoiding divide to * zero (i.e., never < 1) */ unsigned short factor = 50; /* Factor (4..50) limiting threshold to avoid @@ -4529,13 +4529,13 @@ Tcl_TimeRateObjCmd( { Tcl_Obj *objarr[8], **objs = objarr; - TclWideMUInt usec, val; + Tcl_WideUInt usec, val; int digits; /* * Absolute execution time in microseconds or in wide clicks. */ - usec = (TclWideMUInt)(middle - start); + usec = (Tcl_WideUInt)(middle - start); #ifdef TCL_WIDE_CLICKS /* @@ -4565,7 +4565,7 @@ Tcl_TimeRateObjCmd( * Estimate the time of overhead (microsecs). */ - TclWideMUInt curOverhead = overhead * count; + Tcl_WideUInt curOverhead = overhead * count; if (usec > curOverhead) { usec -= curOverhead; diff --git a/generic/tclInt.h b/generic/tclInt.h index 8088d0e..dbb06cd 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3280,13 +3280,6 @@ MODULE_SCOPE void TclInitThreadStorage(void); MODULE_SCOPE void TclFinalizeThreadDataThread(void); MODULE_SCOPE void TclFinalizeThreadStorage(void); -/* TclWideMUInt -- wide integer used for measurement calculations: */ -#if (!defined(_WIN32) || !defined(_MSC_VER) || (_MSC_VER >= 1400)) -# define TclWideMUInt Tcl_WideUInt -#else -/* older MSVS may not allow conversions between unsigned __int64 and double) */ -# define TclWideMUInt Tcl_WideInt -#endif #ifdef TCL_WIDE_CLICKS MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); MODULE_SCOPE double TclpWideClicksToNanoseconds(Tcl_WideInt clicks); diff --git a/generic/tclMain.c b/generic/tclMain.c index 13231b5..bb48dbb 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -64,11 +64,6 @@ NewNativeObj( * source directory to make their own modified versions). */ -#if defined _MSC_VER && _MSC_VER < 1900 -/* isatty is always defined on MSVC 14.0, but not necessarily as CRTIMPORT. */ -extern CRTIMPORT int isatty(int fd); -#endif - /* * The thread-local variables for this file's functions. */ diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index c484fb6..cbffb0d 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -370,7 +370,7 @@ ThreadObjCmd( } else { char buf[20]; - sprintf(buf, "%" TCL_LL_MODIFIER "d", id); + sprintf(buf, "%lld", id); Tcl_AppendResult(interp, "cannot join thread ", buf, NULL); } return result; diff --git a/win/nmakehlp.c b/win/nmakehlp.c index 7536ede..972e8b9 100644 --- a/win/nmakehlp.c +++ b/win/nmakehlp.c @@ -19,15 +19,6 @@ #include #include -/* - * This library is required for x64 builds with _some_ versions of MSVC - */ -#if defined(_M_IA64) || defined(_M_AMD64) -#if _MSC_VER >= 1400 && _MSC_VER < 1500 -#pragma comment(lib, "bufferoverflowU") -#endif -#endif - /* ISO hack for dumb VC++ */ #ifdef _MSC_VER #define snprintf _snprintf diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index cbcb3ed..d658ce4 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -25,14 +25,6 @@ static HINSTANCE hInstance; /* HINSTANCE of this DLL. */ /* - * VC++ 5.x has no 'cpuid' assembler instruction, so we must emulate it - */ - -#if defined(_MSC_VER) && (_MSC_VER <= 1100) && defined (_M_IX86) -#define cpuid __asm __emit 0fh __asm __emit 0a2h -#endif - -/* * The following declaration is for the VC++ DLL entry point. */ diff --git a/win/tclWinPort.h b/win/tclWinPort.h index 2c52b73..e497a23 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -454,12 +454,9 @@ typedef DWORD_PTR * PDWORD_PTR; #if defined(_MSC_VER) || defined(__MSVCRT__) # define environ _environ -# if defined(_MSC_VER) && (_MSC_VER < 1600) -# define hypot _hypot -# endif # define exception _exception # undef EDEADLOCK -# if defined(_MSC_VER) && (_MSC_VER >= 1700) +# if defined(_MSC_VER) # define timezone _timezone # endif #endif /* _MSC_VER || __MSVCRT__ */ @@ -480,18 +477,11 @@ typedef DWORD_PTR * PDWORD_PTR; #endif -/* - * MSVC 8.0 started to mark many standard C library functions depreciated - * including the *printf family and others. Tell it to shut up. - * (_MSC_VER is 1200 for VC6, 1300 or 1310 for vc7.net, 1400 for 8.0) - */ #if defined(_MSC_VER) # pragma warning(disable:4146) # pragma warning(disable:4244) -# if _MSC_VER >= 1400 -# pragma warning(disable:4267) -# pragma warning(disable:4996) -# endif +# pragma warning(disable:4267) +# pragma warning(disable:4996) #endif /* -- cgit v0.12 From 075e333cc26910212a11cc6b689dc9406c54e43b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 17 Dec 2020 15:47:56 +0000 Subject: Undo one change from previous commit: this gives a warning on mingw-w64 --- generic/tclThreadTest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index cbffb0d..c484fb6 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -370,7 +370,7 @@ ThreadObjCmd( } else { char buf[20]; - sprintf(buf, "%lld", id); + sprintf(buf, "%" TCL_LL_MODIFIER "d", id); Tcl_AppendResult(interp, "cannot join thread ", buf, NULL); } return result; -- cgit v0.12 From 63426886f59eb4e4cc53551a575da6229bd25b43 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 17 Dec 2020 16:39:25 +0000 Subject: Further elimination of __int64 type --- doc/IntObj.3 | 2 +- libtommath/tommath.h | 45 ++++++++------------------------------------- unix/configure | 29 ++--------------------------- unix/tcl.m4 | 11 ++--------- 4 files changed, 13 insertions(+), 74 deletions(-) diff --git a/doc/IntObj.3 b/doc/IntObj.3 index e793303..36bfa7d 100644 --- a/doc/IntObj.3 +++ b/doc/IntObj.3 @@ -102,7 +102,7 @@ are provided by the C language standard. The \fBTcl_WideInt\fR type is a typedef defined to be whatever signed integral type covers at least the 64-bit integer range (-9223372036854775808 to 9223372036854775807). Depending on the platform and the C compiler, the actual type might be -\fBlong long int\fR, \fB__int64\fR, or something else. +\fBlong long int\fR, or something else. The \fBmp_int\fR type is a multiple-precision integer type defined by the LibTomMath multiple-precision integer library. .PP diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 8f2867e..053bf09 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -237,22 +237,13 @@ TOOM_SQR_CUTOFF; #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 405) # define MP_DEPRECATED(x) __attribute__((deprecated("replaced by " #x))) -#elif defined(_MSC_VER) && _MSC_VER >= 1500 -# define MP_DEPRECATED(x) __declspec(deprecated("replaced by " #x)) -#else -# define MP_DEPRECATED(x) -#endif - -#ifndef MP_NO_DEPRECATED_PRAGMA -#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 301) # define PRIVATE_MP_DEPRECATED_PRAGMA(s) _Pragma(#s) # define MP_DEPRECATED_PRAGMA(s) PRIVATE_MP_DEPRECATED_PRAGMA(GCC warning s) #elif defined(_MSC_VER) && _MSC_VER >= 1500 +# define MP_DEPRECATED(x) __declspec(deprecated("replaced by " #x)) # define MP_DEPRECATED_PRAGMA(s) __pragma(message(s)) -#endif -#endif - -#ifndef MP_DEPRECATED_PRAGMA +#else +# define MP_DEPRECATED(s) # define MP_DEPRECATED_PRAGMA(s) #endif @@ -341,11 +332,7 @@ mp_err mp_init_u64(mp_int *a, uint64_t b) MP_WUR; uint32_t mp_get_mag_u32(const mp_int *a) MP_WUR; uint64_t mp_get_mag_u64(const mp_int *a) MP_WUR; unsigned long mp_get_mag_ul(const mp_int *a) MP_WUR; -#ifdef _MSC_VER -#define mp_get_mag_ull(a) ((unsigned __int64)mp_get_mag_u64(a)) -#else -unsigned long long mp_get_mag_ull(const mp_int *a) MP_WUR; -#endif +#define mp_get_mag_ull(a) ((unsigned long long)mp_get_mag_u64(a)) /* get integer, set integer (long) */ long mp_get_l(const mp_int *a) MP_WUR; @@ -357,27 +344,15 @@ mp_err mp_init_l(mp_int *a, long b) MP_WUR; void mp_set_ul(mp_int *a, unsigned long b); mp_err mp_init_ul(mp_int *a, unsigned long b) MP_WUR; -#ifdef _MSC_VER /* get integer, set integer (long long) */ -#define mp_get_ll(a) ((__int64)mp_get_i64(a)) +#define mp_get_ll(a) ((long long)mp_get_i64(a)) #define mp_set_ll(a,b) mp_set_i64(a,b) #define mp_init_ll(a,b) mp_init_i64(a,b) /* get integer, set integer (unsigned long long) */ -#define mp_get_ull(a) ((unsigned __int64)mp_get_i64(a)) +#define mp_get_ull(a) ((unsigned long long)mp_get_i64(a)) #define mp_set_ull(a,b) mp_set_u64(a,b) #define mp_init_ull(a,b) mp_init_u64(a,b) -#else -/* get integer, set integer (long long) */ -long long mp_get_ll(const mp_int *a) MP_WUR; -void mp_set_ll(mp_int *a, long long b); -mp_err mp_init_ll(mp_int *a, long long b) MP_WUR; - -/* get integer, set integer (unsigned long long) */ -#define mp_get_ull(a) ((unsigned long long)mp_get_ll(a)) -void mp_set_ull(mp_int *a, unsigned long long b); -mp_err mp_init_ull(mp_int *a, unsigned long long b) MP_WUR; -#endif /* set to single unsigned digit, up to MP_DIGIT_MAX */ void mp_set(mp_int *a, mp_digit b); @@ -386,14 +361,10 @@ mp_err mp_init_set(mp_int *a, mp_digit b) MP_WUR; /* get integer, set integer and init with integer (deprecated) */ MP_DEPRECATED(mp_get_mag_u32/mp_get_u32) unsigned long mp_get_int(const mp_int *a) MP_WUR; MP_DEPRECATED(mp_get_mag_ul/mp_get_ul) unsigned long mp_get_long(const mp_int *a) MP_WUR; -#ifdef _MSC_VER -MP_DEPRECATED(mp_get_mag_ull/mp_get_ull) unsigned __int64 mp_get_long_long(const mp_int *a) MP_WUR; -#endif +MP_DEPRECATED(mp_get_mag_ull/mp_get_ull) unsigned long long mp_get_long_long(const mp_int *a) MP_WUR; MP_DEPRECATED(mp_set_ul) mp_err mp_set_int(mp_int *a, unsigned long b); MP_DEPRECATED(mp_set_ul) mp_err mp_set_long(mp_int *a, unsigned long b); -#ifdef _MSC_VER -MP_DEPRECATED(mp_set_ull) mp_err mp_set_long_long(mp_int *a, unsigned __int64 b); -#endif +MP_DEPRECATED(mp_set_ull) mp_err mp_set_long_long(mp_int *a, unsigned long long b); MP_DEPRECATED(mp_init_ul) mp_err mp_init_set_int(mp_int *a, unsigned long b) MP_WUR; /* copy, b = a */ diff --git a/unix/configure b/unix/configure index f1a899c..9d178bb 100755 --- a/unix/configure +++ b/unix/configure @@ -7621,25 +7621,6 @@ then : else $as_nop tcl_cv_type_64bit=none - # See if the compiler knows natively about __int64 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -__int64 value = (__int64) 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - tcl_type_64bit=__int64 -else $as_nop - tcl_type_64bit="long long" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext # See if we could use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... @@ -7650,7 +7631,7 @@ int main (void) { switch (0) { - case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ; + case 1: case (sizeof(long long)==sizeof(long)): ; } ; return 0; @@ -7658,7 +7639,7 @@ switch (0) { _ACEOF if ac_fn_c_try_compile "$LINENO" then : - tcl_cv_type_64bit=${tcl_type_64bit} + tcl_cv_type_64bit="long long" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi @@ -7670,12 +7651,6 @@ printf "%s\n" "#define TCL_WIDE_INT_IS_LONG 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else - -printf "%s\n" "#define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit}" >>confdefs.h - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${tcl_cv_type_64bit}" >&5 -printf "%s\n" "${tcl_cv_type_64bit}" >&6; } - # Now check for auxiliary declarations { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct dirent64" >&5 printf %s "checking for struct dirent64... " >&6; } diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 01ccead..9917c6b 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2355,23 +2355,16 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [ AC_MSG_CHECKING([for 64-bit integer type]) AC_CACHE_VAL(tcl_cv_type_64bit,[ tcl_cv_type_64bit=none - # See if the compiler knows natively about __int64 - AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], - tcl_type_64bit=__int64, tcl_type_64bit="long long") # See if we could use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... AC_TRY_COMPILE(,[switch (0) { - case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ; - }],tcl_cv_type_64bit=${tcl_type_64bit})]) + case 1: case (sizeof(long long)==sizeof(long)): ; + }],tcl_cv_type_64bit="long long")]) if test "${tcl_cv_type_64bit}" = none ; then AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Do 'long' and 'long long' have the same size (64-bit)?]) AC_MSG_RESULT([yes]) else - AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit}, - [What type should be used to define wide integers?]) - AC_MSG_RESULT([${tcl_cv_type_64bit}]) - # Now check for auxiliary declarations AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[ AC_TRY_COMPILE([#include -- cgit v0.12 From 2a2321bf6ae58b208c063c1c09eb41f5270729d1 Mon Sep 17 00:00:00 2001 From: msi Date: Wed, 6 Jan 2021 19:43:35 +0000 Subject: Fix consistency and grammar in re_syntax.n --- doc/re_syntax.n | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/re_syntax.n b/doc/re_syntax.n index 554f659..446f79f 100644 --- a/doc/re_syntax.n +++ b/doc/re_syntax.n @@ -136,22 +136,22 @@ later, under \fBESCAPES\fR. \fB^\fR . matches at the beginning of the string or a line (according to whether -matching is line-sensitive or not, as described in \fBMATCHING\fR, +matching is newline-sensitive or not, as described in \fBMATCHING\fR, below). .TP \fB$\fR . matches at the end of the string or a line (according to whether -matching is line-sensitive or not, as described in \fBMATCHING\fR, +matching is newline-sensitive or not, as described in \fBMATCHING\fR, below). .RS .PP The difference between string and line matching modes is immaterial when the string does not contain a newline character. The \fB\eA\fR -and \fB\eZ\fR constraint escapes have a similar purpose, but are +and \fB\eZ\fR constraint escapes have a similar purpose but are always constraints for the overall string. .PP -The default line-sensitvity depends on the command that uses the +The default newline-sensitivity depends on the command that uses the regular expression, and can be overridden as described in \fBMETASYNTAX\fR, below. .RE -- cgit v0.12 From 1227eed18e886d212ee05d67dd0208aaebf07cec Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 7 Jan 2021 10:13:24 +0000 Subject: No need any more for -D_ATL_XP_TARGETING=1 --- win/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/Makefile.in b/win/Makefile.in index 3f5bc88..26e8b5c 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -82,7 +82,7 @@ CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@ #CFLAGS = $(CFLAGS_DEBUG) #CFLAGS = $(CFLAGS_OPTIMIZE) #CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) -CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -D_ATL_XP_TARGETING=1 -D__USE_MINGW_ANSI_STDIO=0 -DMP_FIXED_CUTOFFS -DMP_NO_STDINT +CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -D__USE_MINGW_ANSI_STDIO=0 -DMP_FIXED_CUTOFFS -DMP_NO_STDINT # To compile without backward compatibility and deprecated code uncomment the # following -- cgit v0.12 From 4f237d732e8a197cc0f9a8f664c8541f8fbfff76 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 7 Jan 2021 10:55:39 +0000 Subject: Fix warnings when __USE_MINGW_ANSI_STDIO=1 --- generic/tcl.h | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index e0bc708..8993168 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -137,7 +137,11 @@ extern "C" { # define TCL_VARARGS_START(type, name, list) (va_start(list, name), name) #endif /* !TCL_NO_DEPRECATED */ #if defined(__GNUC__) && (__GNUC__ > 2) -# define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__printf__, a, b))) +# if defined(_WIN32) && defined(__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO +# define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__MINGW_PRINTF_FORMAT, a, b))) +# else +# define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__printf__, a, b))) +# endif # define TCL_NORETURN __attribute__ ((noreturn)) # define TCL_NOINLINE __attribute__ ((noinline)) # if defined(BUILD_tcl) || defined(BUILD_tk) @@ -327,11 +331,9 @@ typedef long LONG; #ifdef __APPLE__ # ifdef __LP64__ -# undef TCL_WIDE_INT_TYPE # define TCL_WIDE_INT_IS_LONG 1 # define TCL_CFG_DO64BIT 1 # else /* !__LP64__ */ -# define TCL_WIDE_INT_TYPE long long # undef TCL_WIDE_INT_IS_LONG # undef TCL_CFG_DO64BIT # endif /* __LP64__ */ @@ -359,26 +361,16 @@ typedef long LONG; * sprintf(...,"%" TCL_LL_MODIFIER "d",...). */ -#if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG) -# if defined(_WIN32) && (!defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO) -# define TCL_WIDE_INT_TYPE long long -# define TCL_LL_MODIFIER "I64" -# if defined(_WIN64) -# define TCL_Z_MODIFIER "I" -# endif -# elif defined(__GNUC__) -# define TCL_Z_MODIFIER "z" -# else /* ! _WIN32 && ! __GNUC__ */ +#if !defined(TCL_WIDE_INT_TYPE) && !defined(TCL_WIDE_INT_IS_LONG) && !defined(_WIN32) /* * Don't know what platform it is and configure hasn't discovered what is * going on for us. Try to guess... */ -# include -# if defined(LLONG_MAX) && (LLONG_MAX == LONG_MAX) -# define TCL_WIDE_INT_IS_LONG 1 -# endif -# endif /* _WIN32 */ -#endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */ +# include +# if defined(LLONG_MAX) && (LLONG_MAX == LONG_MAX) +# define TCL_WIDE_INT_IS_LONG 1 +# endif +#endif #ifndef TCL_WIDE_INT_TYPE # define TCL_WIDE_INT_TYPE long long @@ -388,11 +380,17 @@ typedef TCL_WIDE_INT_TYPE Tcl_WideInt; typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; #ifndef TCL_LL_MODIFIER -# define TCL_LL_MODIFIER "ll" +# if defined(_WIN32) && (!defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO) +# define TCL_LL_MODIFIER "I64" +# else +# define TCL_LL_MODIFIER "ll" +# endif #endif /* !TCL_LL_MODIFIER */ #ifndef TCL_Z_MODIFIER # if defined(__GNUC__) && !defined(_WIN32) # define TCL_Z_MODIFIER "z" +# elif defined(_WIN64) +# define TCL_Z_MODIFIER TCL_LL_MODIFIER # else # define TCL_Z_MODIFIER "" # endif -- cgit v0.12 From fed0f920e1c723c2b211581f91d30a1bbea9caf1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 7 Jan 2021 12:14:55 +0000 Subject: Fix mingw-w64 compiler warnings when using __USE_MINGW_ANSI_STDIO=1. Not recommended, but it should work. See: [https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/|gnu printf] --- generic/tcl.h | 294 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 132 insertions(+), 162 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 822d17b..85594c1 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -131,13 +131,17 @@ extern "C" { */ #include -#ifndef TCL_NO_DEPRECATED +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 # define TCL_VARARGS(type, name) (type name, ...) # define TCL_VARARGS_DEF(type, name) (type name, ...) # define TCL_VARARGS_START(type, name, list) (va_start(list, name), name) -#endif +#endif /* !TCL_NO_DEPRECATED */ #if defined(__GNUC__) && (__GNUC__ > 2) -# define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__printf__, a, b))) +# if defined(_WIN32) && defined(__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO +# define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__MINGW_PRINTF_FORMAT, a, b))) +# else +# define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__printf__, a, b))) +# endif # define TCL_NORETURN __attribute__ ((noreturn)) # if defined(BUILD_tcl) || defined(BUILD_tk) # define TCL_NORETURN1 __attribute__ ((noreturn)) @@ -216,7 +220,7 @@ extern "C" { * to be included in a shared library, then it should have the DLLEXPORT * storage class. If is being declared for use by a module that is going to * link against the shared library, then it should have the DLLIMPORT storage - * class. If the symbol is beind declared for a static build or for use from a + * class. If the symbol is being declared for a static build or for use from a * stub library, then the storage class should be empty. * * The convention is that a macro called BUILD_xxxx, where xxxx is the name of @@ -384,13 +388,15 @@ typedef long LONG; */ #if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG) -# if defined(_WIN32) && (!defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO) -# define TCL_WIDE_INT_TYPE __int64 -# ifdef __BORLANDC__ -# define TCL_LL_MODIFIER "L" -# else /* __BORLANDC__ */ -# define TCL_LL_MODIFIER "I64" -# endif /* __BORLANDC__ */ +# ifdef _WIN32 +# define TCL_WIDE_INT_TYPE __int64 +# ifdef __BORLANDC__ +# define TCL_LL_MODIFIER "L" +# elif defined(_WIN32) && (!defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO) +# define TCL_LL_MODIFIER "I64" +# else +# define TCL_LL_MODIFIER "ll" +# endif # elif defined(__GNUC__) # define TCL_WIDE_INT_TYPE long long # define TCL_LL_MODIFIER "ll" @@ -437,7 +443,7 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; # define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val))) #endif /* TCL_WIDE_INT_IS_LONG */ -#if defined(_WIN32) +#ifdef _WIN32 # ifdef __BORLANDC__ typedef struct stati64 Tcl_StatBuf; # elif defined(_WIN64) || defined(_USE_64BIT_TIME_T) @@ -491,7 +497,7 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; */ typedef struct Tcl_Interp -#ifndef TCL_NO_DEPRECATED +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 { /* TIP #330: Strongly discourage extensions from using the string * result. */ @@ -521,7 +527,7 @@ typedef struct Tcl_Interp int errorLineDontUse; /* Don't use in extensions! */ #endif } -#endif /* TCL_NO_DEPRECATED */ +#endif /* !TCL_NO_DEPRECATED */ Tcl_Interp; typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler; @@ -1120,9 +1126,9 @@ typedef struct Tcl_DString { * give the flag) */ -#ifndef TCL_NO_DEPRECATED +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 # define TCL_PARSE_PART1 0x400 -#endif +#endif /* !TCL_NO_DEPRECATED */ /* * Types for linked variables: @@ -1714,7 +1720,7 @@ typedef struct Tcl_FSVersion_ *Tcl_FSVersion; * struct Tcl_Filesystem: * * One such structure exists for each type (kind) of filesystem. It collects - * together in one place all the functions that are part of the specific + * together the functions that form the interface for a particulr the * filesystem. Tcl always accesses the filesystem through one of these * structures. * @@ -1729,147 +1735,119 @@ typedef struct Tcl_Filesystem { * compatibility can be assured. */ Tcl_FSVersion version; /* Version of the filesystem type. */ Tcl_FSPathInFilesystemProc *pathInFilesystemProc; - /* Function to check whether a path is in this + /* Determines whether the pathname is in this * filesystem. This is the most important * filesystem function. */ Tcl_FSDupInternalRepProc *dupInternalRepProc; - /* Function to duplicate internal fs rep. May - * be NULL (but then fs is less efficient). */ + /* Duplicates the internal handle of the node. + * If it is NULL, the filesystem is less + * performant. */ Tcl_FSFreeInternalRepProc *freeInternalRepProc; - /* Function to free internal fs rep. Must be - * implemented if internal representations - * need freeing, otherwise it can be NULL. */ + /* Frees the internal handle of the node. NULL + * only if there is no need to free resources + * used for the internal handle. */ Tcl_FSInternalToNormalizedProc *internalToNormalizedProc; - /* Function to convert internal representation - * to a normalized path. Only required if the - * fs creates pure path objects with no - * string/path representation. */ + /* Converts the internal handle to a normalized + * path. NULL if the filesystem creates nodes + * having no pathname. */ Tcl_FSCreateInternalRepProc *createInternalRepProc; - /* Function to create a filesystem-specific - * internal representation. May be NULL if - * paths have no internal representation, or - * if the Tcl_FSPathInFilesystemProc for this - * filesystem always immediately creates an - * internal representation for paths it - * accepts. */ + /* Creates an internal handle for a pathname. + * May be NULL if pathnames have no internal + * handle or if pathInFilesystemProc always + * immediately creates an internal + * representation for pathnames in the + * filesystem. */ Tcl_FSNormalizePathProc *normalizePathProc; - /* Function to normalize a path. Should be - * implemented for all filesystems which can - * have multiple string representations for - * the same path object. */ + /* Normalizes a path. Should be implemented if + * the filesystems supports multiple paths to + * the same node. */ Tcl_FSFilesystemPathTypeProc *filesystemPathTypeProc; - /* Function to determine the type of a path in - * this filesystem. May be NULL. */ + /* Determines the type of a path in this + * filesystem. May be NULL. */ Tcl_FSFilesystemSeparatorProc *filesystemSeparatorProc; - /* Function to return the separator - * character(s) for this filesystem. Must be - * implemented. */ - Tcl_FSStatProc *statProc; /* Function to process a 'Tcl_FSStat()' call. - * Must be implemented for any reasonable - * filesystem. */ - Tcl_FSAccessProc *accessProc; - /* Function to process a 'Tcl_FSAccess()' - * call. Must be implemented for any + /* Produces the separator character(s) for this + * filesystem. Must not be NULL. */ + Tcl_FSStatProc *statProc; /* Called by 'Tcl_FSStat()'. Provided by any * reasonable filesystem. */ + Tcl_FSAccessProc *accessProc; + /* Called by 'Tcl_FSAccess()'. Implemented by + * any reasonable filesystem. */ Tcl_FSOpenFileChannelProc *openFileChannelProc; - /* Function to process a - * 'Tcl_FSOpenFileChannel()' call. Must be - * implemented for any reasonable - * filesystem. */ + /* Called by 'Tcl_FSOpenFileChannel()'. + * Provided by any reasonable filesystem. */ Tcl_FSMatchInDirectoryProc *matchInDirectoryProc; - /* Function to process a - * 'Tcl_FSMatchInDirectory()'. If not - * implemented, then glob and recursive copy - * functionality will be lacking in the - * filesystem. */ - Tcl_FSUtimeProc *utimeProc; /* Function to process a 'Tcl_FSUtime()' call. - * Required to allow setting (not reading) of - * times with 'file mtime', 'file atime' and - * the open-r/open-w/fcopy implementation of - * 'file copy'. */ - Tcl_FSLinkProc *linkProc; /* Function to process a 'Tcl_FSLink()' call. - * Should be implemented only if the - * filesystem supports links (reading or - * creating). */ + /* Called by 'Tcl_FSMatchInDirectory()'. NULL + * if the filesystem does not support glob or + * recursive copy. */ + Tcl_FSUtimeProc *utimeProc; /* Called by 'Tcl_FSUtime()', by 'file + * mtime' to set (not read) times, 'file + * atime', and the open-r/open-w/fcopy variant + * of 'file copy'. */ + Tcl_FSLinkProc *linkProc; /* Called by 'Tcl_FSLink()'. NULL if reading or + * creating links is not supported. */ Tcl_FSListVolumesProc *listVolumesProc; - /* Function to list any filesystem volumes - * added by this filesystem. Should be - * implemented only if the filesystem adds - * volumes at the head of the filesystem. */ + /* Lists filesystem volumes added by this + * filesystem. NULL if the filesystem does not + * use volumes. */ Tcl_FSFileAttrStringsProc *fileAttrStringsProc; - /* Function to list all attributes strings - * which are valid for this filesystem. If not - * implemented the filesystem will not support - * the 'file attributes' command. This allows - * arbitrary additional information to be - * attached to files in the filesystem. */ + /* List all valid attributes strings. NULL if + * the filesystem does not support the 'file + * attributes' command. Can be used to attach + * arbitrary additional data to files in a + * filesystem. */ Tcl_FSFileAttrsGetProc *fileAttrsGetProc; - /* Function to process a - * 'Tcl_FSFileAttrsGet()' call, used by 'file - * attributes'. */ + /* Called by 'Tcl_FSFileAttrsGet()' and by + * 'file attributes'. */ Tcl_FSFileAttrsSetProc *fileAttrsSetProc; - /* Function to process a - * 'Tcl_FSFileAttrsSet()' call, used by 'file - * attributes'. */ + /* Called by 'Tcl_FSFileAttrsSet()' and by + * 'file attributes'. */ Tcl_FSCreateDirectoryProc *createDirectoryProc; - /* Function to process a - * 'Tcl_FSCreateDirectory()' call. Should be - * implemented unless the FS is read-only. */ + /* Called by 'Tcl_FSCreateDirectory()'. May be + * NULL if the filesystem is read-only. */ Tcl_FSRemoveDirectoryProc *removeDirectoryProc; - /* Function to process a - * 'Tcl_FSRemoveDirectory()' call. Should be - * implemented unless the FS is read-only. */ + /* Called by 'Tcl_FSRemoveDirectory()'. May be + * NULL if the filesystem is read-only. */ Tcl_FSDeleteFileProc *deleteFileProc; - /* Function to process a 'Tcl_FSDeleteFile()' - * call. Should be implemented unless the FS - * is read-only. */ + /* Called by 'Tcl_FSDeleteFile()' May be NULL + * if the filesystem is is read-only. */ Tcl_FSCopyFileProc *copyFileProc; - /* Function to process a 'Tcl_FSCopyFile()' - * call. If not implemented Tcl will fall back - * on open-r, open-w and fcopy as a copying - * mechanism, for copying actions initiated in - * Tcl (not C). */ + /* Called by 'Tcl_FSCopyFile()'. If NULL, for + * a copy operation at the script level (not + * C) Tcl uses open-r, open-w and fcopy. */ Tcl_FSRenameFileProc *renameFileProc; - /* Function to process a 'Tcl_FSRenameFile()' - * call. If not implemented, Tcl will fall - * back on a copy and delete mechanism, for - * rename actions initiated in Tcl (not C). */ + /* Called by 'Tcl_FSRenameFile()'. If NULL, for + * a rename operation at the script level (not + * C) Tcl performs a copy operation followed + * by a delete operation. */ Tcl_FSCopyDirectoryProc *copyDirectoryProc; - /* Function to process a - * 'Tcl_FSCopyDirectory()' call. If not - * implemented, Tcl will fall back on a - * recursive create-dir, file copy mechanism, - * for copying actions initiated in Tcl (not - * C). */ - Tcl_FSLstatProc *lstatProc; /* Function to process a 'Tcl_FSLstat()' call. - * If not implemented, Tcl will attempt to use - * the 'statProc' defined above instead. */ + /* Called by 'Tcl_FSCopyDirectory()'. If NULL, + * for a copy operation at the script level + * (not C) Tcl recursively creates directories + * and copies files. */ + Tcl_FSLstatProc *lstatProc; /* Called by 'Tcl_FSLstat()'. If NULL, Tcl + * attempts to use 'statProc' instead. */ Tcl_FSLoadFileProc *loadFileProc; - /* Function to process a 'Tcl_FSLoadFile()' - * call. If not implemented, Tcl will fall - * back on a copy to native-temp followed by a - * Tcl_FSLoadFile on that temporary copy. */ + /* Called by 'Tcl_FSLoadFile()'. If NULL, Tcl + * performs a copy to a temporary file in the + * native filesystem and then calls + * Tcl_FSLoadFile() on that temporary copy. */ Tcl_FSGetCwdProc *getCwdProc; - /* Function to process a 'Tcl_FSGetCwd()' - * call. Most filesystems need not implement - * this. It will usually only be called once, - * if 'getcwd' is called before 'chdir'. May - * be NULL. */ - Tcl_FSChdirProc *chdirProc; /* Function to process a 'Tcl_FSChdir()' call. - * If filesystems do not implement this, it - * will be emulated by a series of directory - * access checks. Otherwise, virtual - * filesystems which do implement it need only - * respond with a positive return result if - * the dirName is a valid directory in their - * filesystem. They need not remember the - * result, since that will be automatically - * remembered for use by GetCwd. Real - * filesystems should carry out the correct - * action (i.e. call the correct system - * 'chdir' api). If not implemented, then 'cd' - * and 'pwd' will fail inside the - * filesystem. */ + /* Called by 'Tcl_FSGetCwd()'. Normally NULL. + * Usually only called once: If 'getcwd' is + * called before 'chdir' is ever called. */ + Tcl_FSChdirProc *chdirProc; /* Called by 'Tcl_FSChdir()'. For a virtual + * filesystem, chdirProc just returns zero + * (success) if the pathname is a valid + * directory, and some other value otherwise. + * For A real filesystem, chdirProc performs + * the correct action, e.g. calls the system + * 'chdir' function. If not implemented, then + * 'cd' and 'pwd' fail for a pathname in this + * filesystem. On success Tcl stores the + * pathname for use by GetCwd. If NULL, Tcl + * performs records the pathname as the new + * current directory if it passes a series of + * directory access checks. */ } Tcl_Filesystem; /* @@ -2130,29 +2108,28 @@ typedef struct Tcl_EncodingType { * reset to an initial state. If the source * buffer contains the entire input stream to be * converted, this flag should be set. - * TCL_ENCODING_STOPONERROR - If set, then the converter will return - * immediately upon encountering an invalid byte - * sequence or a source character that has no - * mapping in the target encoding. If clear, then - * the converter will skip the problem, - * substituting one or more "close" characters in - * the destination buffer and then continue to + * TCL_ENCODING_STOPONERROR - If set, the converter returns immediately upon + * encountering an invalid byte sequence or a + * source character that has no mapping in the + * target encoding. If clear, the converter + * substitues the problematic character(s) with + * one or more "close" characters in the + * destination buffer and then continues to * convert the source. - * TCL_ENCODING_NO_TERMINATE - If set, Tcl_ExternalToUtf will not append a - * terminating NUL byte. Knowing that it will - * not need space to do so, it will fill all - * dstLen bytes with encoded UTF-8 content, as - * other circumstances permit. If clear, the - * default behavior is to reserve a byte in - * the dst space for NUL termination, and to - * append the NUL byte. + * TCL_ENCODING_NO_TERMINATE - If set, Tcl_ExternalToUtf does not append a + * terminating NUL byte. Since it does not need + * an extra byte for a terminating NUL, it fills + * all dstLen bytes with encoded UTF-8 content if + * needed. If clear, a byte is reserved in the + * dst space for NUL termination, and a + * terminating NUL is appended. * TCL_ENCODING_CHAR_LIMIT - If set and dstCharsPtr is not NULL, then - * Tcl_ExternalToUtf takes the initial value - * of *dstCharsPtr is taken as a limit of the - * maximum number of chars to produce in the - * encoded UTF-8 content. Otherwise, the - * number of chars produced is controlled only - * by other limiting factors. + * Tcl_ExternalToUtf takes the initial value of + * *dstCharsPtr as a limit of the maximum number + * of chars to produce in the encoded UTF-8 + * content. Otherwise, the number of chars + * produced is controlled only by other limiting + * factors. */ #define TCL_ENCODING_START 0x01 @@ -2387,9 +2364,6 @@ typedef int (Tcl_NRPostProc) (ClientData data[], Tcl_Interp *interp, *---------------------------------------------------------------------------- * The following constant is used to test for older versions of Tcl in the * stubs tables. - * - * Jan Nijtman's plus patch uses 0xFCA1BACF, so we need to pick a different - * value since the stubs tables don't match. */ #define TCL_STUB_MAGIC ((int) 0xFCA3BACF) @@ -2416,10 +2390,6 @@ const char * TclTomMathInitializeStubs(Tcl_Interp *interp, #endif /* - * TODO - tommath stubs export goes here! - */ - -/* * Public functions that are not accessible via the stubs table. * Tcl_GetMemoryInfo is needed for AOLserver. [Bug 1868171] */ -- cgit v0.12 From ad4c7a03b7ca435630c9f77c85536dca2ca07f2a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 7 Jan 2021 14:45:40 +0000 Subject: Revise UWIDE_MAX and friends --- generic/tclPort.h | 6 +++--- generic/tclStrToD.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/generic/tclPort.h b/generic/tclPort.h index d3f6233..e927620 100644 --- a/generic/tclPort.h +++ b/generic/tclPort.h @@ -24,8 +24,8 @@ #endif #include "tcl.h" -#define UWIDE_MAX ((Tcl_WideUInt)-1) -#define WIDE_MAX ((Tcl_WideInt)(UWIDE_MAX >> 1)) -#define WIDE_MIN ((Tcl_WideInt)((Tcl_WideUInt)WIDE_MAX+1)) +#define UWIDE_MAX ULLONG_MAX +#define WIDE_MAX LLONG_MAX +#define WIDE_MIN LLONG_MIN #endif /* _TCLPORT */ diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 2f870c6..b5c0ca2 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -538,7 +538,7 @@ TclParseNumber( int under = 0; /* Flag trailing '_' as error if true once * number is accepted. */ -#define ALL_BITS ((Tcl_WideUInt)-1) +#define ALL_BITS UWIDE_MAX #define MOST_BITS (ALL_BITS >> 1) /* @@ -725,7 +725,7 @@ TclParseNumber( && (((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt)) || (octalSignificandWide > - ((Tcl_WideUInt)-1 >> shift)))) { + (UWIDE_MAX >> shift)))) { octalSignificandOverflow = 1; err = mp_init_u64(&octalSignificandBig, octalSignificandWide); @@ -865,7 +865,7 @@ TclParseNumber( if (significandWide != 0 && ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) || - significandWide > ((Tcl_WideUInt)-1 >> shift))) { + significandWide > (UWIDE_MAX >> shift))) { significandOverflow = 1; err = mp_init_u64(&significandBig, significandWide); @@ -917,7 +917,7 @@ TclParseNumber( if (significandWide != 0 && ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) || - significandWide > ((Tcl_WideUInt)-1 >> shift))) { + significandWide > (UWIDE_MAX >> shift))) { significandOverflow = 1; err = mp_init_u64(&significandBig, significandWide); @@ -1597,7 +1597,7 @@ AccumulateDecimalDigit( *wideRepPtr = digit; return 0; } else if (numZeros >= maxpow10_wide - || w > ((Tcl_WideUInt)-1-digit)/pow10_wide[numZeros+1]) { + || w > (UWIDE_MAX-digit)/pow10_wide[numZeros+1]) { /* * Wide multiplication will overflow. Expand the number to a * bignum and fall through into the bignum case. -- cgit v0.12 From 6b7dec8d6a72719ff9684fa6c71ec40b2637d8ba Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 7 Jan 2021 15:31:52 +0000 Subject: define UWIDE_MAX and friends in terms of Tcl_WideUInt/Tcl_WideInt, since we cannot be sure that Tcl_WideInt == long long --- generic/tclPort.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclPort.h b/generic/tclPort.h index e927620..d3f6233 100644 --- a/generic/tclPort.h +++ b/generic/tclPort.h @@ -24,8 +24,8 @@ #endif #include "tcl.h" -#define UWIDE_MAX ULLONG_MAX -#define WIDE_MAX LLONG_MAX -#define WIDE_MIN LLONG_MIN +#define UWIDE_MAX ((Tcl_WideUInt)-1) +#define WIDE_MAX ((Tcl_WideInt)(UWIDE_MAX >> 1)) +#define WIDE_MIN ((Tcl_WideInt)((Tcl_WideUInt)WIDE_MAX+1)) #endif /* _TCLPORT */ -- cgit v0.12 From f09dcac7855bb4d75a3ca3b44b9d5ce188260bff Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 8 Jan 2021 09:37:25 +0000 Subject: Omit -Wdeclaration-after-statement from CFLAGS: No longer needed since we stopped support for MSVC 6++ Change Tcl_WideInt -> long long in various places: Tcl_WideInt could be a 128-bit type, we don't want that everywhere. --- doc/CrtChannel.3 | 6 +-- doc/FileSystem.3 | 6 +-- doc/OpenFileChnl.3 | 8 ++-- generic/tcl.decls | 16 ++++---- generic/tcl.h | 36 ++++++++---------- generic/tclDecls.h | 32 ++++++++-------- generic/tclFileName.c | 22 +++++------ generic/tclIO.c | 14 +++---- generic/tclIOGT.c | 10 ++--- generic/tclIORChan.c | 8 ++-- generic/tclIORTrans.c | 8 ++-- generic/tclInt.decls | 2 +- generic/tclInt.h | 8 ++-- generic/tclIntDecls.h | 4 +- generic/tclStrToD.c | 8 ++-- generic/tclThreadTest.c | 4 +- generic/tclZipfs.c | 12 +++--- macosx/Tcl-Common.xcconfig | 2 +- macosx/tclMacOSXNotify.c | 2 +- unix/configure | 2 +- unix/tcl.m4 | 2 +- unix/tclUnixChan.c | 16 ++++---- unix/tclUnixTime.c | 14 +++---- win/configure | 2 +- win/tcl.m4 | 2 +- win/tclWinChan.c | 16 ++++---- win/tclWinFile.c | 12 +++--- win/tclWinTime.c | 92 +++++++++++++++++++++++----------------------- 28 files changed, 181 insertions(+), 185 deletions(-) diff --git a/doc/CrtChannel.3 b/doc/CrtChannel.3 index 0092cfb..02772e8 100644 --- a/doc/CrtChannel.3 +++ b/doc/CrtChannel.3 @@ -600,9 +600,9 @@ in preference to the \fIseekProc\fR, but both must be defined if the following prototype: .PP .CS -typedef Tcl_WideInt \fBTcl_DriverWideSeekProc\fR( +typedef long long \fBTcl_DriverWideSeekProc\fR( ClientData \fIinstanceData\fR, - Tcl_WideInt \fIoffset\fR, + long long \fIoffset\fR, int \fIseekMode\fR, int *\fIerrorCodePtr\fR); .CE @@ -824,7 +824,7 @@ length. It can be NULL. .CS typedef int \fBTcl_DriverTruncateProc\fR( ClientData \fIinstanceData\fR, - Tcl_WideInt \fIlength\fR); + long long \fIlength\fR); .CE .PP \fIInstanceData\fR is the same as the value passed to diff --git a/doc/FileSystem.3 b/doc/FileSystem.3 index 4e77114..99acf7e 100644 --- a/doc/FileSystem.3 +++ b/doc/FileSystem.3 @@ -144,7 +144,7 @@ Tcl_Obj * Tcl_StatBuf * \fBTcl_AllocStatBuf\fR() .sp -Tcl_WideInt +long long \fBTcl_GetAccessTimeFromStat\fR(\fIstatPtr\fR) .sp unsigned @@ -153,7 +153,7 @@ unsigned Tcl_WideUInt \fBTcl_GetBlocksFromStat\fR(\fIstatPtr\fR) .sp -Tcl_WideInt +long long \fBTcl_GetChangeTimeFromStat\fR(\fIstatPtr\fR) .sp int @@ -174,7 +174,7 @@ int unsigned \fBTcl_GetModeFromStat\fR(\fIstatPtr\fR) .sp -Tcl_WideInt +long long \fBTcl_GetModificationTimeFromStat\fR(\fIstatPtr\fR) .sp Tcl_WideUInt diff --git a/doc/OpenFileChnl.3 b/doc/OpenFileChnl.3 index 82851da..c1d1922 100644 --- a/doc/OpenFileChnl.3 +++ b/doc/OpenFileChnl.3 @@ -92,10 +92,10 @@ int int \fBTcl_OutputBuffered\fR(\fIchannel\fR) .sp -Tcl_WideInt +long long \fBTcl_Seek\fR(\fIchannel, offset, seekMode\fR) .sp -Tcl_WideInt +long long \fBTcl_Tell\fR(\fIchannel\fR) .sp int @@ -190,7 +190,7 @@ A buffer containing the bytes to output to the channel. .AP int bytesToWrite in The number of bytes to consume from \fIcharBuf\fR or \fIbyteBuf\fR and output to the channel. -.AP Tcl_WideInt offset in +.AP "long long" offset in How far to move the access point in the channel at which the next input or output operation will be applied, measured in bytes from the position given by \fIseekMode\fR. May be either positive or negative. @@ -198,7 +198,7 @@ given by \fIseekMode\fR. May be either positive or negative. Relative to which point to seek; used with \fIoffset\fR to calculate the new access point for the channel. Legal values are \fBSEEK_SET\fR, \fBSEEK_CUR\fR, and \fBSEEK_END\fR. -.AP Tcl_WideInt length in +.AP "long long" length in The (non-negative) length to truncate the channel the channel to. .AP "const char" *optionName in The name of an option applicable to this channel, such as \fB\-blocking\fR. diff --git a/generic/tcl.decls b/generic/tcl.decls index c4af7cc..e0708d5 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -1751,10 +1751,10 @@ declare 490 { Tcl_StatBuf *Tcl_AllocStatBuf(void) } declare 491 { - Tcl_WideInt Tcl_Seek(Tcl_Channel chan, Tcl_WideInt offset, int mode) + long long Tcl_Seek(Tcl_Channel chan, long long offset, int mode) } declare 492 { - Tcl_WideInt Tcl_Tell(Tcl_Channel chan) + long long Tcl_Tell(Tcl_Channel chan) } # TIP#91 (back-compat enhancements for channels) dkf @@ -2026,7 +2026,7 @@ declare 559 { # TIP #208 ('chan' command) jeffh declare 560 { - int Tcl_TruncateChannel(Tcl_Channel chan, Tcl_WideInt length) + int Tcl_TruncateChannel(Tcl_Channel chan, long long length) } declare 561 { Tcl_DriverTruncateProc *Tcl_ChannelTruncateProc( @@ -2177,19 +2177,19 @@ declare 595 { int Tcl_GetDeviceTypeFromStat(const Tcl_StatBuf *statPtr) } declare 596 { - Tcl_WideInt Tcl_GetAccessTimeFromStat(const Tcl_StatBuf *statPtr) + long long Tcl_GetAccessTimeFromStat(const Tcl_StatBuf *statPtr) } declare 597 { - Tcl_WideInt Tcl_GetModificationTimeFromStat(const Tcl_StatBuf *statPtr) + long long Tcl_GetModificationTimeFromStat(const Tcl_StatBuf *statPtr) } declare 598 { - Tcl_WideInt Tcl_GetChangeTimeFromStat(const Tcl_StatBuf *statPtr) + long long Tcl_GetChangeTimeFromStat(const Tcl_StatBuf *statPtr) } declare 599 { - Tcl_WideUInt Tcl_GetSizeFromStat(const Tcl_StatBuf *statPtr) + unsigned long long Tcl_GetSizeFromStat(const Tcl_StatBuf *statPtr) } declare 600 { - Tcl_WideUInt Tcl_GetBlocksFromStat(const Tcl_StatBuf *statPtr) + unsigned long long Tcl_GetBlocksFromStat(const Tcl_StatBuf *statPtr) } declare 601 { unsigned Tcl_GetBlockSizeFromStat(const Tcl_StatBuf *statPtr) diff --git a/generic/tcl.h b/generic/tcl.h index dfd025f..08e656d 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -360,24 +360,16 @@ typedef long LONG; * sprintf(...,"%" TCL_LL_MODIFIER "d",...). */ -#if !defined(TCL_WIDE_INT_TYPE) && !defined(TCL_WIDE_INT_IS_LONG) -# ifdef _WIN32 -# if defined(_WIN32) && (!defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO) -# define TCL_LL_MODIFIER "I64" -# else -# define TCL_LL_MODIFIER "ll" -# endif -# elif !defined(__GNUC__) +#if !defined(TCL_WIDE_INT_TYPE) && !defined(TCL_WIDE_INT_IS_LONG) && !defined(_WIN32) && !defined(__GNUC__) /* * Don't know what platform it is and configure hasn't discovered what is * going on for us. Try to guess... */ -# include -# if defined(LLONG_MAX) && (LLONG_MAX == LONG_MAX) -# define TCL_WIDE_INT_IS_LONG 1 -# endif -# endif /* !__GNUC__ */ -#endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */ +# include +# if defined(LLONG_MAX) && (LLONG_MAX == LONG_MAX) +# define TCL_WIDE_INT_IS_LONG 1 +# endif +#endif #ifndef TCL_WIDE_INT_TYPE # define TCL_WIDE_INT_TYPE long long @@ -387,7 +379,11 @@ typedef TCL_WIDE_INT_TYPE Tcl_WideInt; typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; #ifndef TCL_LL_MODIFIER -# define TCL_LL_MODIFIER "ll" +# if defined(_WIN32) && (!defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO) +# define TCL_LL_MODIFIER "I64" +# else +# define TCL_LL_MODIFIER "ll" +# endif #endif /* !TCL_LL_MODIFIER */ #ifndef TCL_Z_MODIFIER # if defined(__GNUC__) && !defined(_WIN32) @@ -955,7 +951,7 @@ typedef struct Tcl_DString { * 64-bit integers). */ -#define TCL_INTEGER_SPACE 24 +#define TCL_INTEGER_SPACE (3*(int)sizeof(Tcl_WideInt)) /* * Flag values passed to Tcl_ConvertElement. @@ -1443,8 +1439,8 @@ typedef int (Tcl_DriverGetHandleProc) (ClientData instanceData, typedef int (Tcl_DriverFlushProc) (ClientData instanceData); typedef int (Tcl_DriverHandlerProc) (ClientData instanceData, int interestMask); -typedef Tcl_WideInt (Tcl_DriverWideSeekProc) (ClientData instanceData, - Tcl_WideInt offset, int mode, int *errorCodePtr); +typedef long long (Tcl_DriverWideSeekProc) (ClientData instanceData, + long long offset, int mode, int *errorCodePtr); /* * TIP #218, Channel Thread Actions */ @@ -1453,8 +1449,8 @@ typedef void (Tcl_DriverThreadActionProc) (ClientData instanceData, /* * TIP #208, File Truncation (etc.) */ -typedef int (Tcl_DriverTruncateProc) (ClientData instanceData, - Tcl_WideInt length); +typedef int (Tcl_DriverTruncateProc) (void *instanceData, + long long length); /* * struct Tcl_ChannelType: diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 9ea6838..baa27e3 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1464,10 +1464,10 @@ EXTERN void Tcl_SetWideIntObj(Tcl_Obj *objPtr, /* 490 */ EXTERN Tcl_StatBuf * Tcl_AllocStatBuf(void); /* 491 */ -EXTERN Tcl_WideInt Tcl_Seek(Tcl_Channel chan, Tcl_WideInt offset, +EXTERN long long Tcl_Seek(Tcl_Channel chan, long long offset, int mode); /* 492 */ -EXTERN Tcl_WideInt Tcl_Tell(Tcl_Channel chan); +EXTERN long long Tcl_Tell(Tcl_Channel chan); /* 493 */ EXTERN Tcl_DriverWideSeekProc * Tcl_ChannelWideSeekProc( const Tcl_ChannelType *chanTypePtr); @@ -1665,7 +1665,7 @@ EXTERN int Tcl_TakeBignumFromObj(Tcl_Interp *interp, Tcl_Obj *obj, void *value); /* 560 */ EXTERN int Tcl_TruncateChannel(Tcl_Channel chan, - Tcl_WideInt length); + long long length); /* 561 */ EXTERN Tcl_DriverTruncateProc * Tcl_ChannelTruncateProc( const Tcl_ChannelType *chanTypePtr); @@ -1771,16 +1771,16 @@ EXTERN int Tcl_GetGroupIdFromStat(const Tcl_StatBuf *statPtr); /* 595 */ EXTERN int Tcl_GetDeviceTypeFromStat(const Tcl_StatBuf *statPtr); /* 596 */ -EXTERN Tcl_WideInt Tcl_GetAccessTimeFromStat(const Tcl_StatBuf *statPtr); +EXTERN long long Tcl_GetAccessTimeFromStat(const Tcl_StatBuf *statPtr); /* 597 */ -EXTERN Tcl_WideInt Tcl_GetModificationTimeFromStat( +EXTERN long long Tcl_GetModificationTimeFromStat( const Tcl_StatBuf *statPtr); /* 598 */ -EXTERN Tcl_WideInt Tcl_GetChangeTimeFromStat(const Tcl_StatBuf *statPtr); +EXTERN long long Tcl_GetChangeTimeFromStat(const Tcl_StatBuf *statPtr); /* 599 */ -EXTERN Tcl_WideUInt Tcl_GetSizeFromStat(const Tcl_StatBuf *statPtr); +EXTERN unsigned long long Tcl_GetSizeFromStat(const Tcl_StatBuf *statPtr); /* 600 */ -EXTERN Tcl_WideUInt Tcl_GetBlocksFromStat(const Tcl_StatBuf *statPtr); +EXTERN unsigned long long Tcl_GetBlocksFromStat(const Tcl_StatBuf *statPtr); /* 601 */ EXTERN unsigned Tcl_GetBlockSizeFromStat(const Tcl_StatBuf *statPtr); /* 602 */ @@ -2446,8 +2446,8 @@ typedef struct TclStubs { Tcl_Obj * (*tcl_NewWideIntObj) (Tcl_WideInt wideValue); /* 488 */ void (*tcl_SetWideIntObj) (Tcl_Obj *objPtr, Tcl_WideInt wideValue); /* 489 */ Tcl_StatBuf * (*tcl_AllocStatBuf) (void); /* 490 */ - Tcl_WideInt (*tcl_Seek) (Tcl_Channel chan, Tcl_WideInt offset, int mode); /* 491 */ - Tcl_WideInt (*tcl_Tell) (Tcl_Channel chan); /* 492 */ + long long (*tcl_Seek) (Tcl_Channel chan, long long offset, int mode); /* 491 */ + long long (*tcl_Tell) (Tcl_Channel chan); /* 492 */ Tcl_DriverWideSeekProc * (*tcl_ChannelWideSeekProc) (const Tcl_ChannelType *chanTypePtr); /* 493 */ int (*tcl_DictObjPut) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr, Tcl_Obj *valuePtr); /* 494 */ int (*tcl_DictObjGet) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr, Tcl_Obj **valuePtrPtr); /* 495 */ @@ -2515,7 +2515,7 @@ typedef struct TclStubs { void (*tcl_SetBignumObj) (Tcl_Obj *obj, void *value); /* 557 */ int (*tcl_GetBignumFromObj) (Tcl_Interp *interp, Tcl_Obj *obj, void *value); /* 558 */ int (*tcl_TakeBignumFromObj) (Tcl_Interp *interp, Tcl_Obj *obj, void *value); /* 559 */ - int (*tcl_TruncateChannel) (Tcl_Channel chan, Tcl_WideInt length); /* 560 */ + int (*tcl_TruncateChannel) (Tcl_Channel chan, long long length); /* 560 */ Tcl_DriverTruncateProc * (*tcl_ChannelTruncateProc) (const Tcl_ChannelType *chanTypePtr); /* 561 */ void (*tcl_SetChannelErrorInterp) (Tcl_Interp *interp, Tcl_Obj *msg); /* 562 */ void (*tcl_GetChannelErrorInterp) (Tcl_Interp *interp, Tcl_Obj **msg); /* 563 */ @@ -2551,11 +2551,11 @@ typedef struct TclStubs { int (*tcl_GetUserIdFromStat) (const Tcl_StatBuf *statPtr); /* 593 */ int (*tcl_GetGroupIdFromStat) (const Tcl_StatBuf *statPtr); /* 594 */ int (*tcl_GetDeviceTypeFromStat) (const Tcl_StatBuf *statPtr); /* 595 */ - Tcl_WideInt (*tcl_GetAccessTimeFromStat) (const Tcl_StatBuf *statPtr); /* 596 */ - Tcl_WideInt (*tcl_GetModificationTimeFromStat) (const Tcl_StatBuf *statPtr); /* 597 */ - Tcl_WideInt (*tcl_GetChangeTimeFromStat) (const Tcl_StatBuf *statPtr); /* 598 */ - Tcl_WideUInt (*tcl_GetSizeFromStat) (const Tcl_StatBuf *statPtr); /* 599 */ - Tcl_WideUInt (*tcl_GetBlocksFromStat) (const Tcl_StatBuf *statPtr); /* 600 */ + long long (*tcl_GetAccessTimeFromStat) (const Tcl_StatBuf *statPtr); /* 596 */ + long long (*tcl_GetModificationTimeFromStat) (const Tcl_StatBuf *statPtr); /* 597 */ + long long (*tcl_GetChangeTimeFromStat) (const Tcl_StatBuf *statPtr); /* 598 */ + unsigned long long (*tcl_GetSizeFromStat) (const Tcl_StatBuf *statPtr); /* 599 */ + unsigned long long (*tcl_GetBlocksFromStat) (const Tcl_StatBuf *statPtr); /* 600 */ unsigned (*tcl_GetBlockSizeFromStat) (const Tcl_StatBuf *statPtr); /* 601 */ int (*tcl_SetEnsembleParameterList) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj *paramList); /* 602 */ int (*tcl_GetEnsembleParameterList) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj **paramListPtr); /* 603 */ diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 6ef768d..4ef9e39 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -2600,44 +2600,44 @@ Tcl_GetDeviceTypeFromStat( return (int) statPtr->st_rdev; } -Tcl_WideInt +long long Tcl_GetAccessTimeFromStat( const Tcl_StatBuf *statPtr) { - return (Tcl_WideInt) statPtr->st_atime; + return (long long) statPtr->st_atime; } -Tcl_WideInt +long long Tcl_GetModificationTimeFromStat( const Tcl_StatBuf *statPtr) { - return (Tcl_WideInt) statPtr->st_mtime; + return (long long) statPtr->st_mtime; } -Tcl_WideInt +long long Tcl_GetChangeTimeFromStat( const Tcl_StatBuf *statPtr) { - return (Tcl_WideInt) statPtr->st_ctime; + return (long long) statPtr->st_ctime; } -Tcl_WideUInt +unsigned long long Tcl_GetSizeFromStat( const Tcl_StatBuf *statPtr) { - return (Tcl_WideUInt) statPtr->st_size; + return (unsigned long long) statPtr->st_size; } -Tcl_WideUInt +unsigned long long Tcl_GetBlocksFromStat( const Tcl_StatBuf *statPtr) { #ifdef HAVE_STRUCT_STAT_ST_BLOCKS - return (Tcl_WideUInt) statPtr->st_blocks; + return (unsigned long long) statPtr->st_blocks; #else unsigned blksize = Tcl_GetBlockSizeFromStat(statPtr); - return ((Tcl_WideUInt) statPtr->st_size + blksize - 1) / blksize; + return ((unsigned long long) statPtr->st_size + blksize - 1) / blksize; #endif } diff --git a/generic/tclIO.c b/generic/tclIO.c index 2afd2cf..9cace8c 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -6989,10 +6989,10 @@ GetInput( *---------------------------------------------------------------------- */ -Tcl_WideInt +long long Tcl_Seek( Tcl_Channel chan, /* The channel on which to seek. */ - Tcl_WideInt offset, /* Offset to seek to. */ + long long offset, /* Offset to seek to. */ int mode) /* Relative to which location to seek? */ { Channel *chanPtr = (Channel *) chan; @@ -7002,7 +7002,7 @@ Tcl_Seek( int inputBuffered, outputBuffered; /* # bytes held in buffers. */ int result; /* Of device driver operations. */ - Tcl_WideInt curPos; /* Position on the device. */ + long long curPos; /* Position on the device. */ int wasAsync; /* Was the channel nonblocking before the seek * operation? If so, must restore to * non-blocking mode after the seek. */ @@ -7162,7 +7162,7 @@ Tcl_Seek( *---------------------------------------------------------------------- */ -Tcl_WideInt +long long Tcl_Tell( Tcl_Channel chan) /* The channel to return pos for. */ { @@ -7173,7 +7173,7 @@ Tcl_Tell( int inputBuffered, outputBuffered; /* # bytes held in buffers. */ int result; /* Of calling device driver. */ - Tcl_WideInt curPos; /* Position on device. */ + long long curPos; /* Position on device. */ if (CheckChannelErrors(statePtr, TCL_WRITABLE | TCL_READABLE) != 0) { return -1; @@ -7257,7 +7257,7 @@ Tcl_Tell( int Tcl_TruncateChannel( Tcl_Channel chan, /* Channel to truncate. */ - Tcl_WideInt length) /* Length to truncate it to. */ + long long length) /* Length to truncate it to. */ { Channel *chanPtr = (Channel *) chan; Tcl_DriverTruncateProc *truncateProc = @@ -9159,7 +9159,7 @@ TclCopyChannel( Tcl_Interp *interp, /* Current interpreter. */ Tcl_Channel inChan, /* Channel to read from. */ Tcl_Channel outChan, /* Channel to write to. */ - Tcl_WideInt toRead, /* Amount of data to copy, or -1 for all. */ + long long toRead, /* Amount of data to copy, or -1 for all. */ Tcl_Obj *cmdPtr) /* Pointer to script to execute or NULL. */ { Channel *inPtr = (Channel *) inChan; diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index 95a8e0e..f03fcca 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -41,8 +41,8 @@ static void TransformWatchProc(ClientData instanceData, int mask); static int TransformGetFileHandleProc(ClientData instanceData, int direction, ClientData *handlePtr); static int TransformNotifyProc(ClientData instanceData, int mask); -static Tcl_WideInt TransformWideSeekProc(ClientData instanceData, - Tcl_WideInt offset, int mode, int *errorCodePtr); +static long long TransformWideSeekProc(ClientData instanceData, + long long offset, int mode, int *errorCodePtr); /* * Forward declarations of internal procedures. Secondly the procedures for @@ -907,10 +907,10 @@ TransformSeekProc( *---------------------------------------------------------------------- */ -static Tcl_WideInt +static long long TransformWideSeekProc( ClientData instanceData, /* The channel to manipulate. */ - Tcl_WideInt offset, /* Size of movement. */ + long long offset, /* Size of movement. */ int mode, /* How to move. */ int *errorCodePtr) /* Location of error flag. */ { @@ -922,7 +922,7 @@ TransformWideSeekProc( #endif Tcl_DriverWideSeekProc *parentWideSeekProc = Tcl_ChannelWideSeekProc(parentType); - ClientData parentData = Tcl_GetChannelInstanceData(parent); + void *parentData = Tcl_GetChannelInstanceData(parent); if ((offset == 0) && (mode == SEEK_CUR)) { /* diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 888d946..e6e8e58 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -44,8 +44,8 @@ static void ReflectThread(ClientData clientData, int action); static int ReflectEventRun(Tcl_Event *ev, int flags); static int ReflectEventDelete(Tcl_Event *ev, ClientData cd); #endif -static Tcl_WideInt ReflectSeekWide(ClientData clientData, - Tcl_WideInt offset, int mode, int *errorCodePtr); +static long long ReflectSeekWide(ClientData clientData, + long long offset, int mode, int *errorCodePtr); #ifndef TCL_NO_DEPRECATED static int ReflectSeek(ClientData clientData, long offset, int mode, int *errorCodePtr); @@ -1550,10 +1550,10 @@ ReflectOutput( *---------------------------------------------------------------------- */ -static Tcl_WideInt +static long long ReflectSeekWide( ClientData clientData, - Tcl_WideInt offset, + long long offset, int seekMode, int *errorCodePtr) { diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index 29c5158..b06bd45 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -39,8 +39,8 @@ static int ReflectOutput(ClientData clientData, const char *buf, int toWrite, int *errorCodePtr); static void ReflectWatch(ClientData clientData, int mask); static int ReflectBlock(ClientData clientData, int mode); -static Tcl_WideInt ReflectSeekWide(ClientData clientData, - Tcl_WideInt offset, int mode, int *errorCodePtr); +static long long ReflectSeekWide(ClientData clientData, + long long offset, int mode, int *errorCodePtr); #ifndef TCL_NO_DEPRECATED static int ReflectSeek(ClientData clientData, long offset, int mode, int *errorCodePtr); @@ -1327,10 +1327,10 @@ ReflectOutput( *---------------------------------------------------------------------- */ -static Tcl_WideInt +static long long ReflectSeekWide( ClientData clientData, - Tcl_WideInt offset, + long long offset, int seekMode, int *errorCodePtr) { diff --git a/generic/tclInt.decls b/generic/tclInt.decls index e25443d..a4ed641 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -981,7 +981,7 @@ declare 247 { declare 248 { int TclCopyChannel(Tcl_Interp *interp, Tcl_Channel inChan, - Tcl_Channel outChan, Tcl_WideInt toRead, Tcl_Obj *cmdPtr) + Tcl_Channel outChan, long long toRead, Tcl_Obj *cmdPtr) } declare 249 { diff --git a/generic/tclInt.h b/generic/tclInt.h index dbb06cd..fa2360c 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3281,19 +3281,19 @@ MODULE_SCOPE void TclFinalizeThreadDataThread(void); MODULE_SCOPE void TclFinalizeThreadStorage(void); #ifdef TCL_WIDE_CLICKS -MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); -MODULE_SCOPE double TclpWideClicksToNanoseconds(Tcl_WideInt clicks); +MODULE_SCOPE long long TclpGetWideClicks(void); +MODULE_SCOPE double TclpWideClicksToNanoseconds(long long clicks); MODULE_SCOPE double TclpWideClickInMicrosec(void); #else # ifdef _WIN32 # define TCL_WIDE_CLICKS 1 -MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); +MODULE_SCOPE long long TclpGetWideClicks(void); MODULE_SCOPE double TclpWideClickInMicrosec(void); # define TclpWideClicksToNanoseconds(clicks) \ ((double)(clicks) * TclpWideClickInMicrosec() * 1000) # endif #endif -MODULE_SCOPE Tcl_WideInt TclpGetMicroseconds(void); +MODULE_SCOPE long long TclpGetMicroseconds(void); MODULE_SCOPE int TclZlibInit(Tcl_Interp *interp); MODULE_SCOPE void * TclpThreadCreateKey(void); diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 71d9f5c..1e7e26d 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -618,7 +618,7 @@ EXTERN void TclResetRewriteEnsemble(Tcl_Interp *interp, /* 248 */ EXTERN int TclCopyChannel(Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, - Tcl_WideInt toRead, Tcl_Obj *cmdPtr); + long long toRead, Tcl_Obj *cmdPtr); /* 249 */ EXTERN char * TclDoubleDigits(double dv, int ndigits, int flags, int *decpt, int *signum, char **endPtr); @@ -916,7 +916,7 @@ typedef struct TclIntStubs { Tcl_HashTable * (*tclGetNamespaceCommandTable) (Tcl_Namespace *nsPtr); /* 245 */ int (*tclInitRewriteEnsemble) (Tcl_Interp *interp, int numRemoved, int numInserted, Tcl_Obj *const *objv); /* 246 */ void (*tclResetRewriteEnsemble) (Tcl_Interp *interp, int isRootEnsemble); /* 247 */ - int (*tclCopyChannel) (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, Tcl_WideInt toRead, Tcl_Obj *cmdPtr); /* 248 */ + int (*tclCopyChannel) (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, long long toRead, Tcl_Obj *cmdPtr); /* 248 */ char * (*tclDoubleDigits) (double dv, int ndigits, int flags, int *decpt, int *signum, char **endPtr); /* 249 */ void (*tclSetChildCancelFlags) (Tcl_Interp *interp, int flags, int force); /* 250 */ int (*tclRegisterLiteral) (void *envPtr, const char *bytes, int length, int flags); /* 251 */ diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index b5c0ca2..7c1d779 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -5251,21 +5251,21 @@ TclFormatNaN( #else union { double dv; - Tcl_WideUInt iv; + unsigned long long iv; } bitwhack; bitwhack.dv = value; if (n770_fp) { bitwhack.iv = Nokia770Twiddle(bitwhack.iv); } - if (bitwhack.iv & ((Tcl_WideUInt) 1 << 63)) { - bitwhack.iv &= ~ ((Tcl_WideUInt) 1 << 63); + if (bitwhack.iv & (1ULL << 63)) { + bitwhack.iv &= ~ (1ULL << 63); *buffer++ = '-'; } *buffer++ = 'N'; *buffer++ = 'a'; *buffer++ = 'N'; - bitwhack.iv &= (((Tcl_WideUInt) 1) << 51) - 1; + bitwhack.iv &= ((1ULL) << 51) - 1; if (bitwhack.iv != 0) { sprintf(buffer, "(%" TCL_LL_MODIFIER "x)", bitwhack.iv); } else { diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index c484fb6..9f08d83 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -368,9 +368,9 @@ ThreadObjCmd( if (result == TCL_OK) { Tcl_SetIntObj(Tcl_GetObjResult(interp), status); } else { - char buf[20]; + char buf[TCL_INTEGER_SPACE]; - sprintf(buf, "%" TCL_LL_MODIFIER "d", id); + sprintf(buf, "%" TCL_LL_MODIFIER "d", (long long)id); Tcl_AppendResult(interp, "cannot join thread ", buf, NULL); } return result; diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index e84b490..572fcd5 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -228,7 +228,7 @@ typedef struct ZipFile { typedef struct ZipEntry { char *name; /* The full pathname of the virtual file */ ZipFile *zipFilePtr; /* The ZIP file holding this virtual file */ - Tcl_WideInt offset; /* Data offset into memory mapped ZIP file */ + long long offset; /* Data offset into memory mapped ZIP file */ int numBytes; /* Uncompressed size of the virtual file */ int numCompressedBytes; /* Compressed size of the virtual file */ int compressMethod; /* Compress method */ @@ -336,7 +336,7 @@ static int ZipChannelRead(void *instanceData, char *buf, static int ZipChannelSeek(void *instanceData, long offset, int mode, int *errloc); #endif -static Tcl_WideInt ZipChannelWideSeek(void *instanceData, Tcl_WideInt offset, +static long long ZipChannelWideSeek(void *instanceData, long long offset, int mode, int *errloc); static void ZipChannelWatchChannel(void *instanceData, int mask); @@ -2058,7 +2058,7 @@ ZipAddFile( const char *zpath; int crc, flush, zpathlen; size_t nbyte, nbytecompr, len, olen, align = 0; - Tcl_WideInt pos[3]; + long long pos[3]; int mtime = 0, isNew, compMeth; unsigned long keys[3], keys0[3]; char obuf[4096]; @@ -2412,7 +2412,7 @@ ZipFSMkZipOrImgObjCmd( Tcl_Channel out; int pwlen = 0, count, ret = TCL_ERROR, lobjc; size_t len, slen = 0, i = 0; - Tcl_WideInt pos[3]; + long long pos[3]; Tcl_Obj **lobjv, *list = NULL; ZipEntry *z; Tcl_HashEntry *hPtr; @@ -3444,10 +3444,10 @@ ZipChannelWrite( *------------------------------------------------------------------------- */ -static Tcl_WideInt +static long long ZipChannelWideSeek( void *instanceData, - Tcl_WideInt offset, + long long offset, int mode, int *errloc) { diff --git a/macosx/Tcl-Common.xcconfig b/macosx/Tcl-Common.xcconfig index 39301db..5193b70 100644 --- a/macosx/Tcl-Common.xcconfig +++ b/macosx/Tcl-Common.xcconfig @@ -19,7 +19,7 @@ GCC_NO_COMMON_BLOCKS = YES GCC_DYNAMIC_NO_PIC = YES GCC_VERSION = 4.2 GCC = gcc-$(GCC_VERSION) -WARNING_CFLAGS = -Wall -Wextra -Wshadow -Wwrite-strings -Wpointer-arith -Wc++-compat -Wdeclaration-after-statement -Winit-self -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS) +WARNING_CFLAGS = -Wall -Wextra -Wshadow -Wwrite-strings -Wpointer-arith -Wc++-compat -Winit-self -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS) BINDIR = $(PREFIX)/bin CFLAGS = $(CFLAGS) CPPFLAGS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET) $(CPPFLAGS) diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c index 3bf5e08..dd2b898 100644 --- a/macosx/tclMacOSXNotify.c +++ b/macosx/tclMacOSXNotify.c @@ -239,7 +239,7 @@ static OSSpinLock notifierLock = SPINLOCK_INIT; #define SpinLockLockDbg(p) \ if (!SpinLockTry(p)) { \ - Tcl_WideInt s = TclpGetWideClicks(), e; \ + long long s = TclpGetWideClicks(), e; \ \ SpinLockLock(p); \ e = TclpGetWideClicks(); \ diff --git a/unix/configure b/unix/configure index c25305e..0678188 100755 --- a/unix/configure +++ b/unix/configure @@ -5585,7 +5585,7 @@ then : *++|*++-*) ;; *) - CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers -Wdeclaration-after-statement" + CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers" ;; esac diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 95a9e10..651d5fa 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -965,7 +965,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ *++|*++-*) ;; *) - CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers -Wdeclaration-after-statement" + CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers" ;; esac diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 71ff61d..837aa59 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -133,9 +133,9 @@ static int FileSeekProc(void *instanceData, long offset, int mode, int *errorCode); #endif static int FileTruncateProc(void *instanceData, - Tcl_WideInt length); -static Tcl_WideInt FileWideSeekProc(void *instanceData, - Tcl_WideInt offset, int mode, int *errorCode); + long long length); +static long long FileWideSeekProc(void *instanceData, + long long offset, int mode, int *errorCode); static void FileWatchProc(void *instanceData, int mask); #ifdef SUPPORTS_TTY static int TtyCloseProc(void *instanceData, @@ -456,7 +456,7 @@ FileSeekProc( int *errorCodePtr) /* To store error code. */ { FileState *fsPtr = (FileState *)instanceData; - Tcl_WideInt oldLoc, newLoc; + long long oldLoc, newLoc; /* * Save our current place in case we need to roll-back the seek. @@ -509,16 +509,16 @@ FileSeekProc( *---------------------------------------------------------------------- */ -static Tcl_WideInt +static long long FileWideSeekProc( void *instanceData, /* File state. */ - Tcl_WideInt offset, /* Offset to seek to. */ + long long offset, /* Offset to seek to. */ int mode, /* Relative to where should we seek? Can be * one of SEEK_START, SEEK_CUR or SEEK_END. */ int *errorCodePtr) /* To store error code. */ { FileState *fsPtr = (FileState *)instanceData; - Tcl_WideInt newLoc; + long long newLoc; newLoc = TclOSseek(fsPtr->fd, (Tcl_SeekOffset) offset, mode); @@ -2037,7 +2037,7 @@ Tcl_GetOpenFile( static int FileTruncateProc( void *instanceData, - Tcl_WideInt length) + long long length) { FileState *fsPtr = (FileState *)instanceData; int result; diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index ead7b0c..adeacb6 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -100,13 +100,13 @@ TclpGetSeconds(void) *---------------------------------------------------------------------- */ -Tcl_WideInt +long long TclpGetMicroseconds(void) { Tcl_Time time; tclGetTimeProcPtr(&time, tclTimeClientData); - return ((Tcl_WideInt)time.sec)*1000000 + time.usec; + return ((long long)time.sec)*1000000 + time.usec; } /* @@ -177,19 +177,19 @@ TclpGetClicks(void) *---------------------------------------------------------------------- */ -Tcl_WideInt +long long TclpGetWideClicks(void) { - Tcl_WideInt now; + long long now; if (tclGetTimeProcPtr != NativeGetTime) { Tcl_Time time; tclGetTimeProcPtr(&time, tclTimeClientData); - now = ((Tcl_WideInt)time.sec)*1000000 + time.usec; + now = ((long long)time.sec)*1000000 + time.usec; } else { #ifdef MAC_OSX_TCL - now = (Tcl_WideInt) (mach_absolute_time() & INT64_MAX); + now = (long long) (mach_absolute_time() & INT64_MAX); #else #error Wide high-resolution clicks not implemented on this platform #endif @@ -217,7 +217,7 @@ TclpGetWideClicks(void) double TclpWideClicksToNanoseconds( - Tcl_WideInt clicks) + long long clicks) { double nsec; diff --git a/win/configure b/win/configure index 0ee2d52..95d9bbb 100755 --- a/win/configure +++ b/win/configure @@ -4360,7 +4360,7 @@ printf "%s\n" "using shared flags" >&6; } CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format" ;; *) - CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers -Wdeclaration-after-statement" + CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers" ;; esac diff --git a/win/tcl.m4 b/win/tcl.m4 index fe715eb..ca26311 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -673,7 +673,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format" ;; *) - CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers -Wdeclaration-after-statement" + CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers" ;; esac diff --git a/win/tclWinChan.c b/win/tclWinChan.c index 03671f9..a4ec1ae 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -89,14 +89,14 @@ static int FileOutputProc(ClientData instanceData, static int FileSeekProc(ClientData instanceData, long offset, int mode, int *errorCode); #endif -static Tcl_WideInt FileWideSeekProc(ClientData instanceData, - Tcl_WideInt offset, int mode, int *errorCode); +static long long FileWideSeekProc(ClientData instanceData, + long long offset, int mode, int *errorCode); static void FileSetupProc(ClientData clientData, int flags); static void FileWatchProc(ClientData instanceData, int mask); static void FileThreadActionProc(ClientData instanceData, int action); static int FileTruncateProc(ClientData instanceData, - Tcl_WideInt length); + long long length); static DWORD FileGetType(HANDLE handle); static int NativeIsComPort(const WCHAR *nativeName); @@ -546,10 +546,10 @@ FileSeekProc( *---------------------------------------------------------------------- */ -static Tcl_WideInt +static long long FileWideSeekProc( ClientData instanceData, /* File state. */ - Tcl_WideInt offset, /* Offset to seek to. */ + long long offset, /* Offset to seek to. */ int mode, /* Relative to where should we seek? */ int *errorCodePtr) /* To store error code. */ { @@ -578,8 +578,8 @@ FileWideSeekProc( return -1; } } - return (((Tcl_WideInt)((unsigned)newPos)) - | ((Tcl_WideInt)newPosHigh << 32)); + return (((long long)((unsigned)newPos)) + | ((long long)newPosHigh << 32)); } /* @@ -601,7 +601,7 @@ FileWideSeekProc( static int FileTruncateProc( ClientData instanceData, /* File state. */ - Tcl_WideInt length) /* Length to truncate at. */ + long long length) /* Length to truncate at. */ { FileInfo *infoPtr = (FileInfo *)instanceData; LONG newPos, newPosHigh, oldPos, oldPosHigh; diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 953259d..f89b522 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -29,7 +29,7 @@ */ #define POSIX_EPOCH_AS_FILETIME \ - ((Tcl_WideInt) 116444736 * (Tcl_WideInt) 1000000000) + ((long long) 116444736 * (long long) 1000000000) /* * Declarations for 'link' related information. This information should come @@ -2102,8 +2102,8 @@ NativeStat( statPtr->st_ctime = ToCTime(data.ftCreationTime); } attr = data.dwFileAttributes; - statPtr->st_size = ((Tcl_WideInt) data.nFileSizeLow) | - (((Tcl_WideInt) data.nFileSizeHigh) << 32); + statPtr->st_size = ((long long) data.nFileSizeLow) | + (((long long) data.nFileSizeHigh) << 32); /* * On Unix, for directories, nlink apparently depends on the number of @@ -2150,8 +2150,8 @@ NativeStat( attr = data.dwFileAttributes; - statPtr->st_size = ((Tcl_WideInt) data.nFileSizeLow) | - (((Tcl_WideInt) data.nFileSizeHigh) << 32); + statPtr->st_size = ((long long) data.nFileSizeLow) | + (((long long) data.nFileSizeHigh) << 32); statPtr->st_atime = ToCTime(data.ftLastAccessTime); statPtr->st_mtime = ToCTime(data.ftLastWriteTime); statPtr->st_ctime = ToCTime(data.ftCreationTime); @@ -2313,7 +2313,7 @@ ToCTime( convertedTime.HighPart = (LONG) fileTime.dwHighDateTime; return (time_t) ((convertedTime.QuadPart - - (Tcl_WideInt) POSIX_EPOCH_AS_FILETIME) / (Tcl_WideInt) 10000000); + (long long) POSIX_EPOCH_AS_FILETIME) / (long long) 10000000); } /* diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 088c02b..64890c4 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -83,9 +83,9 @@ typedef struct { * Data used in developing the estimate of performance counter frequency */ - Tcl_WideUInt fileTimeSample[SAMPLES]; + unsigned long long fileTimeSample[SAMPLES]; /* Last 64 samples of system time. */ - Tcl_WideInt perfCounterSample[SAMPLES]; + long long perfCounterSample[SAMPLES]; /* Last 64 samples of performance counter. */ int sampleNo; /* Current sample number. */ } TimeInfo; @@ -99,11 +99,11 @@ static TimeInfo timeInfo = { (HANDLE) NULL, (HANDLE) NULL, #if defined(HAVE_CAST_TO_UNION) && !defined(__cplusplus) - (LARGE_INTEGER) (Tcl_WideInt) 0, + (LARGE_INTEGER) (long long) 0, (ULARGE_INTEGER) (DWORDLONG) 0, - (LARGE_INTEGER) (Tcl_WideInt) 0, - (LARGE_INTEGER) (Tcl_WideInt) 0, - (LARGE_INTEGER) (Tcl_WideInt) 0, + (LARGE_INTEGER) (long long) 0, + (LARGE_INTEGER) (long long) 0, + (LARGE_INTEGER) (long long) 0, #else {0, 0}, {0, 0}, @@ -137,13 +137,13 @@ static struct tm * ComputeGMT(const time_t *tp); static void StopCalibration(ClientData clientData); static DWORD WINAPI CalibrationThread(LPVOID arg); static void UpdateTimeEachSecond(void); -static void ResetCounterSamples(Tcl_WideUInt fileTime, - Tcl_WideInt perfCounter, Tcl_WideInt perfFreq); -static Tcl_WideInt AccumulateSample(Tcl_WideInt perfCounter, - Tcl_WideUInt fileTime); +static void ResetCounterSamples(unsigned long long fileTime, + long long perfCounter, long long perfFreq); +static long long AccumulateSample(long long perfCounter, + unsigned long long fileTime); static void NativeScaleTime(Tcl_Time* timebuf, ClientData clientData); -static Tcl_WideInt NativeGetMicroseconds(void); +static long long NativeGetMicroseconds(void); static void NativeGetTime(Tcl_Time* timebuf, ClientData clientData); @@ -175,7 +175,7 @@ ClientData tclTimeClientData = NULL; unsigned long TclpGetSeconds(void) { - Tcl_WideInt usecSincePosixEpoch; + long long usecSincePosixEpoch; /* Try to use high resolution timer */ if ( tclGetTimeProcPtr == NativeGetTime @@ -212,7 +212,7 @@ TclpGetSeconds(void) unsigned long TclpGetClicks(void) { - Tcl_WideInt usecSincePosixEpoch; + long long usecSincePosixEpoch; /* Try to use high resolution timer */ if ( tclGetTimeProcPtr == NativeGetTime @@ -251,7 +251,7 @@ TclpGetClicks(void) *---------------------------------------------------------------------- */ -Tcl_WideInt +long long TclpGetWideClicks(void) { LARGE_INTEGER curCounter; @@ -277,7 +277,7 @@ TclpGetWideClicks(void) } if (wideClick.perfCounter) { if (QueryPerformanceCounter(&curCounter)) { - return (Tcl_WideInt)curCounter.QuadPart; + return (long long)curCounter.QuadPart; } /* fallback using microseconds */ wideClick.perfCounter = 0; @@ -332,10 +332,10 @@ TclpWideClickInMicrosec(void) *---------------------------------------------------------------------- */ -Tcl_WideInt +long long TclpGetMicroseconds(void) { - Tcl_WideInt usecSincePosixEpoch; + long long usecSincePosixEpoch; /* Try to use high resolution timer */ if ( tclGetTimeProcPtr == NativeGetTime @@ -351,7 +351,7 @@ TclpGetMicroseconds(void) Tcl_Time now; tclGetTimeProcPtr(&now, tclTimeClientData); /* Tcl_GetTime inlined */ - return (((Tcl_WideInt)now.sec) * 1000000) + now.usec; + return (((long long)now.sec) * 1000000) + now.usec; } } @@ -381,7 +381,7 @@ void Tcl_GetTime( Tcl_Time *timePtr) /* Location to store time information. */ { - Tcl_WideInt usecSincePosixEpoch; + long long usecSincePosixEpoch; /* Try to use high resolution timer */ if ( tclGetTimeProcPtr == NativeGetTime @@ -444,7 +444,7 @@ NativeScaleTime( *---------------------------------------------------------------------- */ -static inline Tcl_WideInt +static inline long long NativeCalc100NsTicks( ULONGLONG fileTimeLastCall, LONGLONG perfCounterLastCall, @@ -455,7 +455,7 @@ NativeCalc100NsTicks( ((curCounter - perfCounterLastCall) * 10000000 / curCounterFreq); } -static Tcl_WideInt +static long long NativeGetMicroseconds(void) { /* @@ -507,10 +507,10 @@ NativeGetMicroseconds(void) /* * The following lines would do an exact match on crystal * frequency: - * && timeInfo.nominalFreq.QuadPart != (Tcl_WideInt)1193182 - * && timeInfo.nominalFreq.QuadPart != (Tcl_WideInt)3579545 + * && timeInfo.nominalFreq.QuadPart != (long long)1193182 + * && timeInfo.nominalFreq.QuadPart != (long long)3579545 */ - && timeInfo.nominalFreq.QuadPart > (Tcl_WideInt) 15000000){ + && timeInfo.nominalFreq.QuadPart > (long long) 15000000){ /* * As an exception, if every logical processor on the system * is on the same chip, we use the performance counter anyway, @@ -651,7 +651,7 @@ NativeGetTime( Tcl_Time *timePtr, TCL_UNUSED(ClientData)) { - Tcl_WideInt usecSincePosixEpoch; + long long usecSincePosixEpoch; /* * Try to use high resolution timer. @@ -1033,12 +1033,12 @@ UpdateTimeEachSecond(void) static LARGE_INTEGER lastFileTime; /* File time of the previous calibration */ LARGE_INTEGER curFileTime; /* File time at the time this callback was * scheduled. */ - Tcl_WideInt estFreq; /* Estimated perf counter frequency. */ - Tcl_WideInt vt0; /* Tcl time right now. */ - Tcl_WideInt vt1; /* Tcl time one second from now. */ - Tcl_WideInt tdiff; /* Difference between system clock and Tcl + long long estFreq; /* Estimated perf counter frequency. */ + long long vt0; /* Tcl time right now. */ + long long vt1; /* Tcl time one second from now. */ + long long tdiff; /* Difference between system clock and Tcl * time. */ - Tcl_WideInt driftFreq; /* Frequency needed to drift virtual time into + long long driftFreq; /* Frequency needed to drift virtual time into * step over 1 second. */ /* @@ -1090,7 +1090,7 @@ UpdateTimeEachSecond(void) */ estFreq = AccumulateSample(curPerfCounter.QuadPart, - (Tcl_WideUInt) curFileTime.QuadPart); + (unsigned long long) curFileTime.QuadPart); /* * We want to adjust things so that time appears to be continuous. @@ -1155,7 +1155,7 @@ UpdateTimeEachSecond(void) * new calibrated values) and do a small adjustment (short time freeze) */ LARGE_INTEGER newPerfCounter; - Tcl_WideInt nt0, nt1; + long long nt0, nt1; QueryPerformanceCounter(&newPerfCounter); nt0 = NativeCalc100NsTicks(timeInfo.fileTimeLastCall.QuadPart, @@ -1215,9 +1215,9 @@ UpdateTimeEachSecond(void) static void ResetCounterSamples( - Tcl_WideUInt fileTime, /* Current file time */ - Tcl_WideInt perfCounter, /* Current performance counter */ - Tcl_WideInt perfFreq) /* Target performance frequency */ + unsigned long long fileTime, /* Current file time */ + long long perfCounter, /* Current performance counter */ + long long perfFreq) /* Target performance frequency */ { int i; for (i=SAMPLES-1 ; i>=0 ; --i) { @@ -1255,20 +1255,20 @@ ResetCounterSamples( * case). */ -static Tcl_WideInt +static long long AccumulateSample( - Tcl_WideInt perfCounter, - Tcl_WideUInt fileTime) + long long perfCounter, + unsigned long long fileTime) { - Tcl_WideUInt workFTSample; /* File time sample being removed from or + unsigned long long workFTSample; /* File time sample being removed from or * added to the circular buffer. */ - Tcl_WideInt workPCSample; /* Performance counter sample being removed + long long workPCSample; /* Performance counter sample being removed * from or added to the circular buffer. */ - Tcl_WideUInt lastFTSample; /* Last file time sample recorded */ - Tcl_WideInt lastPCSample; /* Last performance counter sample recorded */ - Tcl_WideInt FTdiff; /* Difference between last FT and current */ - Tcl_WideInt PCdiff; /* Difference between last PC and current */ - Tcl_WideInt estFreq; /* Estimated performance counter frequency */ + unsigned long long lastFTSample; /* Last file time sample recorded */ + long long lastPCSample; /* Last performance counter sample recorded */ + long long FTdiff; /* Difference between last FT and current */ + long long PCdiff; /* Difference between last PC and current */ + long long estFreq; /* Estimated performance counter frequency */ /* * Test for jumps and reset the samples if we have one. @@ -1302,7 +1302,7 @@ AccumulateSample( estFreq = 10000000 * (perfCounter - workPCSample) / (fileTime - workFTSample); timeInfo.perfCounterSample[timeInfo.sampleNo] = perfCounter; - timeInfo.fileTimeSample[timeInfo.sampleNo] = (Tcl_WideInt) fileTime; + timeInfo.fileTimeSample[timeInfo.sampleNo] = (long long) fileTime; /* * Advance the sample number. -- cgit v0.12 From 4206bf28183d7010bb79c3b2c889930f4783a6a0 Mon Sep 17 00:00:00 2001 From: msi Date: Fri, 8 Jan 2021 19:55:51 +0000 Subject: Improve description of Unix options for [file attributes] (Pt. 1) --- doc/file.n | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/file.n b/doc/file.n index 43eae7a..d39d927 100644 --- a/doc/file.n +++ b/doc/file.n @@ -50,16 +50,16 @@ can be given to the command, but it returns a group name. \fB\-owner\fR gets or sets the user name of the owner of the file. The command returns the owner name, but the numerical id can be passed when setting the owner. \fB\-permissions\fR sets or retrieves the octal code that chmod(1) -uses. This command does also has limited support for setting using the -symbolic attributes for chmod(1), of the form [ugo]?[[+\-=][rwxst],[...]], -where multiple symbolic attributes can be separated by commas (example: -\fBu+s,go\-rw\fR add sticky bit for user, remove read and write -permissions for group and other). A simplified \fBls\fR style string, -of the form rwxrwxrwx (must be 9 characters), is also supported -(example: \fBrwxr\-xr\-t\fR is equivalent to 01755). -On versions of Unix supporting file flags, \fB\-readonly\fR gives the -value or sets or clears the readonly attribute of the file, -i.e. the user immutable flag \fBuchg\fR to chflags(1). +uses. This option also provides limited support for setting permissions +using the symbolic notation used by the Unix chmod(1) command, following the +form [ugo]?[[+-=][rwxst],[...]]. Multiple permission specifications may be +given, separated by commas. E.g., \fBu+s,go-rw\fR would set the setuid bit +for a file's owner as well as remove read and write permission for the file's +group and other users. A simplified \fBls\fR style string, of the form +rwxrwxrwx (must be 9 characters), is also supported (example: +\fBrwxr\-xr\-t\fR is equivalent to 01755). On versions of Unix supporting +file flags, \fB\-readonly\fR gives the value or sets or clears the readonly +attribute of the file, i.e. the user immutable flag \fBuchg\fR to chflags(1). .PP On Windows, \fB\-archive\fR gives the value or sets or clears the archive attribute of the file. \fB\-hidden\fR gives the value or sets -- cgit v0.12