Jan Jezabek | 7 Aug 13:44
Favicon

Some problems with function hiding (C# new)

Hi,

I ran across a bug (?) in Allocate::function_is_defined_in_bases shown 
by this example:

%module bbase

%rename (aaa2) B::aaa();
%rename (bbb) B::bbb2();

%inline %{

class A {
   public:
   int aaa();
   int bbb();
   int ccc;
};

class B : public A {
   public:
   int aaa();
   int bbb2();
   void ccc(int);
};

%}

The problem is the incorrect generation of the "hides" attribute - 
B::aaa2 has this attribute set while B::bbb has it cleared. Thus B::aaa2 
(Continue reading)

Jan Jezabek | 7 Aug 15:01
Favicon

Re: Some problems with function hiding (C# new)

Here's a follow-up with some further (related) bugs:

%module bbase

%rename (aaa2) B::aaa();
%rename (bbb) B::bbb2();

%ignore C;

%rename (aaa2) G::aaa();

%inline %{

class A {
   public:
   int aaa();
   int bbb();
   int ccc;
};

class B : public A {
   public:
   int aaa();
   int bbb2();
   void ccc(int);
};

class C {
   public:
   virtual int aaa();
(Continue reading)

Jan Jezabek | 7 Aug 22:03
Favicon

Re: Some problems with function hiding (C# new)

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.

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
(Continue reading)

William S Fulton | 12 Aug 22:19
Favicon

Re: Some problems with function hiding (C# new)

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.
> 
> 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:
(Continue reading)

William S Fulton | 28 Sep 23:48
Favicon

Re: Some problems with function hiding (C# new)

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.
(Continue reading)

Jan Jezabek | 29 Sep 22:52
Favicon

Re: Some problems with function hiding (C# new)

William S Fulton wrote:
> 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).
(Continue reading)

Jan Jezabek | 27 Oct 18:48
Favicon

Re: Some problems with function hiding (C# new)

Jan Jezabek wrote:
> William S Fulton wrote:
>> 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' 
(Continue reading)


Gmane