#4238 Use gcc attributes to mark Tcl_Interp fields deprecated

obsolete: 8.6a4
closed-fixed
5
2012-04-10
2008-12-22
Anonymous
No

Although there has been an effort to deprecate the fields of the Tcl_Interp structure as not being suitable for public use, because there is a backward compatibility macro that people can set, there is a danger that lazy programmers will just set it and then ignore the fact that they are using something that will go away. Then they'll get caught out and gripe (unfairly) that we didn't warn them. Programmers are like that.

If we set it so that (when we're using gcc) we use 'deprecated' attributes on the result, freeProc and errorLine fields of the Tcl_Interp (i.e. so that if people don't define USE_INTERP_RESULT and USE_INTERP_ERRORLINE they guarantee that they won't get warnings) then such code as has a problem will become noisy and inclined to be fixed. People needing higher levels of assurance who are using -Werror probably ought to move to the new APIs sooner so as to get a longer guaranteed support period.

More info about the right sort of attributes is on:
http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html
Search for 'deprecated' for what I'm talking about using.

Discussion

  • Donal K. Fellows

    Damnit, I submitted this!

     
  • miguel sofer

    miguel sofer - 2011-05-08
    • assigned_to: msofer --> dkf
     
  • miguel sofer

    miguel sofer - 2011-05-08

    I do not see the possibility of deprecating fields of a struct, and we certainly do not want to deprecate Tcl_Interp. What di you have in mind?

     
  • Donal K. Fellows

    Reading through the GCC docs again, I see that __attribute__((__deprecated__)) *can* be applied to fields, if your version of GCC is new enough. What it does is cause access to those fields (but not the overall structure) to generate a warning. (You can supply a custom warning message from gcc 4.5 onwards.) It doesn't generate an error (unless you specify that all warnings are errors, in which case you're very much at the mercy of problems in OS headers too).

    Tcl itself doesn't touch those fields (it does in the Interp structure, but that's not got any warnings applied to it).

     
  • Donal K. Fellows

    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks