summaryrefslogtreecommitdiff
path: root/giscanner/codegen.py
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@gnome.org>2015-09-27 13:06:49 -0500
committerMichael Catanzaro <mcatanzaro@gnome.org>2015-09-27 13:06:56 -0500
commit232f3c831260f596e36159112292897962a505b4 (patch)
treebfa8aae73980843ccbb3ddc50ff79193550a4447 /giscanner/codegen.py
parent5ae7bd58b6266997b61d897ad6562118eeb59210 (diff)
downloadgobject-introspection-232f3c831260f596e36159112292897962a505b4.tar.gz
Revert "scanner: Warn and ignore on incorrect transfer annotations"
It broke at least atk and mutter. This reverts commit 5ae7bd58b6266997b61d897ad6562118eeb59210.
Diffstat (limited to 'giscanner/codegen.py')
-rw-r--r--giscanner/codegen.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/giscanner/codegen.py b/giscanner/codegen.py
index fcf1fc51..e0eb182f 100644
--- a/giscanner/codegen.py
+++ b/giscanner/codegen.py
@@ -84,30 +84,28 @@ class CCodeGenerator(object):
self._write_prelude(self.out_h, func)
self.out_h.write(";\n\n")
- def _write_annotation_transfer(self, node):
- if (node.type not in ast.BASIC_TYPES or
- node.type.ctype.endswith('*')):
- self.out_c.write(" (transfer %s)" % (node.transfer, ))
+ def _write_annotation_transfer(self, transfer):
+ self.out_c.write("(transfer %s)" % (transfer, ))
def _write_docs(self, func):
self.out_c.write("/**\n * %s:\n" % (func.symbol, ))
for param in func.parameters:
- self.out_c.write(" * @%s" % (param.argname, ))
+ self.out_c.write(" * @%s: " % (param.argname, ))
if param.direction in (ast.PARAM_DIRECTION_OUT,
ast.PARAM_DIRECTION_INOUT):
if param.caller_allocates:
allocate_string = ' caller-allocates'
else:
allocate_string = ''
- self.out_c.write(": (%s%s) " % (param.direction,
- allocate_string))
- self._write_annotation_transfer(param)
+ self.out_c.write("(%s%s) " % (param.direction,
+ allocate_string))
+ self._write_annotation_transfer(param.transfer)
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(' * Returns: ')
+ self._write_annotation_transfer(func.retval.transfer)
self.out_c.write('\n */')
@contextmanager