Skip to content
Tcl Source Code History Of Ticket 2997642
Login

History Of Ticket 2997642

Artifacts Associated With Ticket 2997642

  1. Ticket change [2194ab30f0] (rid 130612) by nijtmans on 2010-05-06 14:37:11:

    1. assignee initialized to: "nijtmans"
    2. cmimetype initialized to: "text/plain"
    3. 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.
      
    4. foundin initialized to: "None"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "nijtmans"
    10. subsystem initialized to: "39. Package Manager"
    11. title initialized to: "many type casts needed when using Tcl_Pkg* API"
    12. type initialized to: "Patch"
  2. Ticket change [ab2ccdcf8b] (rid 101055) by nijtmans on 2010-05-06 21:38:15:

    1. icomment:
      
      
      File Added - 373071: tcl-pkg.patch
      
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  3. Add attachment "tcl-pkg.patch" [fc07628ee5] (rid 108161) by nijtmans on 2010-05-06 21:38:15.

  4. Ticket change [9059ea52cf] (rid 120435) by nijtmans on 2010-08-30 20:49:34:

    1. assignee changed to: "jenglish"
    2. 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.
      
      
    3. login: "nijtmans"
    4. mimetype: "text/plain"
    5. username: "nijtmans"
  5. Ticket change [076fd6452e] (rid 89398) by nijtmans on 2010-08-30 20:51:32:

    1. priority changed to: "9 Immediate"
  6. Ticket change [41a65bad6f] (rid 116229) by jenglish on 2010-08-31 01:35:03:

    1. 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.)
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  7. Ticket change [e3f5e46186] (rid 87881) by nijtmans on 2010-09-01 04:02:35:

    1. 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. :-(
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. resolution changed to: "Fixed"
    5. username: "nijtmans"
  8. Ticket change [8f46c4b5a5] (rid 120254) by jenglish on 2010-09-09 00:13:32:

    1. assignee changed to: "nijtmans"
  9. Ticket change [a3dca6d761] (rid 110112) by nijtmans on 2010-09-09 04:14:37:

    1. closedate changed to: "2010-09-08T21:14:37"
    2. closer changed to: "nijtmans"
    3. icomment:
      
      
      allow_comments - 1
      
      Done, so can be closed
      
      
    4. login: "nijtmans"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "nijtmans"