From 09c466f0184e74ba6f279f103ad3be3a7e1f2a06 Mon Sep 17 00:00:00 2001 From: Garrett Regier Date: Mon, 6 Jul 2015 18:54:23 -0700 Subject: scanner: Warn and ignore return annotations when there is no return value Otherwise the .gir can contain invalid data which would likely cause a crash at runtime. https://bugzilla.gnome.org/show_bug.cgi?id=752044 Signed-off-by: Garrett Regier --- giscanner/codegen.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'giscanner/codegen.py') diff --git a/giscanner/codegen.py b/giscanner/codegen.py index ff1a435a..0d4a8d8b 100644 --- a/giscanner/codegen.py +++ b/giscanner/codegen.py @@ -108,10 +108,11 @@ class CCodeGenerator(object): self._write_annotation_transfer(param) self.out_c.write(":\n") self.out_c.write(' *\n') - self.out_c.write(' * Undocumented.\n') - self.out_c.write(' *\n') - self.out_c.write(' * Returns:') - self._write_annotation_transfer(func.retval) + self.out_c.write(' * Undocumented.') + if func.retval.type != ast.TYPE_NONE: + self.out_c.write('\n *\n') + self.out_c.write(' * Returns: ') + self._write_annotation_transfer(func.retval) self.out_c.write('\n */') @contextmanager -- cgit v1.2.1