Warning fix for final destructor in directors
Fix suppression of final destructors used in director classes. Add testcase for final destructors in director classes.
This commit is contained in:
parent
cbae09f92f
commit
b9c4a84780
3 changed files with 11 additions and 0 deletions
|
|
@ -1,6 +1,9 @@
|
||||||
%module(directors="1") cpp11_final_directors
|
%module(directors="1") cpp11_final_directors
|
||||||
|
|
||||||
%director Derived;
|
%director Derived;
|
||||||
|
%director BaseFinalDestructor;
|
||||||
|
|
||||||
|
%warnfilter(SWIGWARN_LANG_DIRECTOR_FINAL) BaseFinalDestructor::~BaseFinalDestructor;
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
struct Base {
|
struct Base {
|
||||||
|
|
@ -13,4 +16,9 @@ struct Derived : Base {
|
||||||
virtual int meth() { return 2; }
|
virtual int meth() { return 2; }
|
||||||
virtual ~Derived() {}
|
virtual ~Derived() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct BaseFinalDestructor {
|
||||||
|
virtual void basefinalmeth() final {}
|
||||||
|
virtual ~BaseFinalDestructor() final {}
|
||||||
|
};
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
1
Examples/test-suite/errors/cpp_final_destructor.stderr
Normal file
1
Examples/test-suite/errors/cpp_final_destructor.stderr
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
cpp_final_destructor.i:7: Warning 525: Destructor of director base class BaseFinal is marked as final.
|
||||||
|
|
@ -2200,7 +2200,9 @@ int Language::classDirector(Node *n) {
|
||||||
Node *nodeType = Getattr(ni, "nodeType");
|
Node *nodeType = Getattr(ni, "nodeType");
|
||||||
if (Cmp(nodeType, "destructor") == 0 && GetFlag(ni, "final")) {
|
if (Cmp(nodeType, "destructor") == 0 && GetFlag(ni, "final")) {
|
||||||
String *classtype = Getattr(n, "classtype");
|
String *classtype = Getattr(n, "classtype");
|
||||||
|
SWIG_WARN_NODE_BEGIN(ni);
|
||||||
Swig_warning(WARN_LANG_DIRECTOR_FINAL, input_file, line_number, "Destructor of director base class %s is marked as final.\n", classtype);
|
Swig_warning(WARN_LANG_DIRECTOR_FINAL, input_file, line_number, "Destructor of director base class %s is marked as final.\n", classtype);
|
||||||
|
SWIG_WARN_NODE_END(ni);
|
||||||
Delete(vtable);
|
Delete(vtable);
|
||||||
Delete(using_protected_members_code);
|
Delete(using_protected_members_code);
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue