diff options
author | Robert Bradshaw <robertwb@gmail.com> | 2013-11-01 20:43:36 -0700 |
---|---|---|
committer | Robert Bradshaw <robertwb@gmail.com> | 2013-11-01 20:43:36 -0700 |
commit | 37f9fcff2c0e8517f8fdda5d87ab7ccb8f6f9243 (patch) | |
tree | 2c6a80bda558c09ff9d74422cd24a5ef20ec9b32 /Cython/Compiler/ModuleNode.py | |
parent | 31890343f048e58ebe7986cf56d6fbdeaf7c16b7 (diff) | |
download | cython-37f9fcff2c0e8517f8fdda5d87ab7ccb8f6f9243.tar.gz |
Get rid of 'virtual methods without virtual destructor' warning.
Diffstat (limited to 'Cython/Compiler/ModuleNode.py')
-rw-r--r-- | Cython/Compiler/ModuleNode.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 49b61e0cd..75fc2083b 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -773,12 +773,19 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): [base_class.declaration_code("") for base_class in type.base_classes]) code.put(" : public %s" % base_class_decl) code.putln(" {") + has_virtual_methods = False + has_destructor = False for attr in scope.var_entries: if attr.type.is_cfunction and attr.name != "<init>": code.put("virtual ") + has_virtual_methods = True + if attr.cname[0] == '~': + has_destructor = True code.putln( "%s;" % attr.type.declaration_code(attr.cname)) + if has_virtual_methods and not has_destructor: + code.put("virtual ~%s() { }" % type.cname) code.putln("};") def generate_enum_definition(self, entry, code): |