Artifacts Associated With Ticket 2997642
Ticket change [2194ab30f0] (rid 130612) by nijtmans on 2010-05-06 14:37:11:
- assignee initialized to: "nijtmans"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Since Tcl 8.6, all stub pointers became "const". The Tcl_Pkg* functions have a ClientData parameter for registering them. Because this parameter is not const, it means that in tclBasic.c, tclTomMathInterface.c, tclStubLib.c, and tclTomMathStubLib.c type casts need to be used in order to silence the compiler warning. There must be a better way. Therefore, I suggest to change the API of the following 4 functions: Tcl_PkgProvideEx Tcl_PkgRequireEx Tcl_PkgPresentEx Tcl_PkgRequireProc so that they can be used without type casts in this situation. Attached patch shows how to do that. This is 100% source and binary compatible. The real changes are only in tcl.decls (and the generate tclDecls.h) and tclPkg.c. The other files don't need to be modified, but are just a demonstration how they can be cleaned up without type casts after the signature change. doc update is in the patch as well. - foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nijtmans"
- subsystem initialized to: "39. Package Manager"
- title initialized to: "many type casts needed when using Tcl_Pkg* API"
- type initialized to: "Patch"
Ticket change [ab2ccdcf8b] (rid 101055) by nijtmans on 2010-05-06 21:38:15:
- icomment:
File Added - 373071: tcl-pkg.patch
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Add attachment "tcl-pkg.patch" [fc07628ee5] (rid 108161) by nijtmans on 2010-05-06 21:38:15.
Ticket change [9059ea52cf] (rid 120435) by nijtmans on 2010-08-30 20:49:34:
- assignee changed to: "jenglish"
- icomment:
Partly committed (except for Tcl_PkgProvideEx signature change). Joe, please evaluate. I am convinced this is a pure improvement, and 100% binary and source compatible, but if you can find any problem with it feel free to revert. The tclStubLib.c and tclTomMathStubLib.c modifications serve as demonstration how this change can benefit code.
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
Ticket change [076fd6452e] (rid 89398) by nijtmans on 2010-08-30 20:51:32:
- priority changed to: "9 Immediate"
Ticket change [41a65bad6f] (rid 116229) by jenglish on 2010-08-31 01:35:03:
- icomment:
Remembering that "ClientData" == "void *": Previous signature had: Tcl_PkgProvideEx(...., void *clientData); Tcl_PkgRequireEx(..., void **clientData_rtn); IOW: put pointer-to-T in, get void * back out, which the caller must convert back to a pointer-to-T. (Note that the PkgRequire() call did not require an explicit cast even under the old signature when using the usual idiom, and the PkgProvide call only needed a cast-away-from-const cast if the clientData is a pointer-to-const-T.) New signature has: Tcl_PkgProvideEx(...., const void *clientData); Tcl_PkgRequireEx(..., void *rtn); IOW: put a pointer-to-T or pointer-to-const-T in, get *anything* back out. This pokes an even bigger hole in the type system (including internally removing 'const' qualifiers), but since 'void *' is already involved that's probably not a big deal; we're already relying on the caller to get things right, the compiler won't help here. As long as it does not cause a regression of #1091431, it's probably OK. (Basically: make sure that if you're changing the usual idiom void *pkgData = NULL; if (Tcl_PkgRequireEx(...., &pkgData) != NULL && pkgData != NULL) fooStubsPtr = pkgData; to Tcl_PkgRequireEx(..., &fooStubsPtr); make sure that 'fooStubsPtr' doesn't get stomped in cases where the PkgRequire() fails. (It doesn't look like that should happen, but I can't really tell; the PkgRequire() codepath has gotten a lot more convoluted since last I looked at it.) - login: "jenglish"
- mimetype: "text/plain"
- username: "jenglish"
- icomment:
Ticket change [e3f5e46186] (rid 87881) by nijtmans on 2010-09-01 04:02:35:
- icomment:
Remaining part committed. tclStubLib.c and tclTomMathStubLib.c change reverted as Twylite reported to me that MSVC++ 6.0 gives a warning with this construct. :-(
- login: "nijtmans"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- username: "nijtmans"
- icomment:
Ticket change [8f46c4b5a5] (rid 120254) by jenglish on 2010-09-09 00:13:32:
- assignee changed to: "nijtmans"
Ticket change [a3dca6d761] (rid 110112) by nijtmans on 2010-09-09 04:14:37:
- closedate changed to: "2010-09-08T21:14:37"
- closer changed to: "nijtmans"
- icomment:
allow_comments - 1 Done, so can be closed
- login: "nijtmans"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "nijtmans"