Commit 37f9fcff authored by Robert Bradshaw's avatar Robert Bradshaw

Get rid of 'virtual methods without virtual destructor' warning.

parent 31890343
...@@ -773,12 +773,19 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -773,12 +773,19 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
[base_class.declaration_code("") for base_class in type.base_classes]) [base_class.declaration_code("") for base_class in type.base_classes])
code.put(" : public %s" % base_class_decl) code.put(" : public %s" % base_class_decl)
code.putln(" {") code.putln(" {")
has_virtual_methods = False
has_destructor = False
for attr in scope.var_entries: for attr in scope.var_entries:
if attr.type.is_cfunction and attr.name != "<init>": if attr.type.is_cfunction and attr.name != "<init>":
code.put("virtual ") code.put("virtual ")
has_virtual_methods = True
if attr.cname[0] == '~':
has_destructor = True
code.putln( code.putln(
"%s;" % "%s;" %
attr.type.declaration_code(attr.cname)) attr.type.declaration_code(attr.cname))
if has_virtual_methods and not has_destructor:
code.put("virtual ~%s() { }" % type.cname)
code.putln("};") code.putln("};")
def generate_enum_definition(self, entry, code): def generate_enum_definition(self, entry, code):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment