From: William S F. <ws...@fu...> - 2008-09-28 22:53:41
|
Jan Jezabek wrote: > Hi everyone, > > I have come up with a patch for the issues mentioned previously. There > is still a warning if you overload a name that has been used as a > variable in a base class (see A::ccc and B::ccc(int) in the previous > message) - I am still not sure how to handle this. > That's an unusual case, I don't have any suggestions. > The main part of the patch - consisting of modifications to allocate.cxx > - is here (rev 10739 in my branch): > http://swig.svn.sourceforge.net/viewvc/swig/branches/gsoc2008-jezabek/Source/Modules/allocate.cxx?r1=10418&r2=10739 > > If you prefer the resulting file then you can find it here: > http://swig.svn.sourceforge.net/viewvc/swig/branches/gsoc2008-jezabek/Source/Modules/allocate.cxx?revision=10739&view=markup > > The patch separates the part of function_is_defined_in_bases which was > responsible for checking if the function is virtual - this part should > not be sensitive to %ignore and %rename. The remaining part of > function_is_defined_in_bases only checks the bases that are superclasses > in the target language (this was not exactly the case earlier - if a > base class B was ignored but its superclass A was not then a class > deriving from B could have methods with the 'override' modifier - see > inherit_same_name4 test-case). > > I have tested this change using check-csharp-test-suite; the only > difference was that the rname testcase stopped complaining about an > unnecessary 'new' modifier. > > I have also created test cases that trigger warnings and errors with the > previous code - these are revisions 10740 and 10742, available here: > http://swig.svn.sourceforge.net/viewvc/swig?view=rev&revision=10740 > http://swig.svn.sourceforge.net/viewvc/swig?view=rev&revision=10742 > > Finally I have made a minor change to allocate.cxx for finding methods > that have been overloaded in a subclass (see my first message in this > thread): > http://swig.svn.sourceforge.net/viewvc/swig?view=rev&revision=10741 > > All of these changes are still in my branch, but they are not really > COM-specific (apart of 10741) so I'd be happy to merge them to trunk > once they are reviewed and accepted as correct. > Sorry for the delays in looking at this. It automates what users previously had to do manually for C#, ie fix up the override/new modifier in the C# proxy class which is nice. I've a query about overloads_base which you have added for the COM module. I can't quite work out what this does, eg this triggers the attribute being set: struct Base { virtual void overload1() {} virtual void overload1(int) {} virtual ~Base() {} }; struct Derived : Base { void overload1(int) {} }; but this does not: struct Base { virtual void overload1() {} virtual void overload1(int) {} virtual ~Base() {} }; struct Derived : Base { void overload1() {} }; Perhaps you can explain better in allocate.cxx what exactly the attribute is meant to do and fix what looks like to be a bug? Is it meant to be indicating an overridden method that is overloaded in the base class? I presume this is targeting the sym:name rather than name so it takes into acccount %ignore, %rename? One minor point is as a general rule, attribute names don't have underscores, so overloads_base ought to become overloadsbase. William |