diff options
author | Garrett Regier <garrett.regier@riftio.com> | 2015-07-06 18:54:23 -0700 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2015-10-04 17:34:12 -0400 |
commit | 09c466f0184e74ba6f279f103ad3be3a7e1f2a06 (patch) | |
tree | 717499c4cb224dd35ffef2feed10bc0a274b62ae /giscanner/maintransformer.py | |
parent | 849f1eef10b18eddaf41c1e0b2cca87bf5d93739 (diff) | |
download | gobject-introspection-09c466f0184e74ba6f279f103ad3be3a7e1f2a06.tar.gz |
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 <garrett.regier@riftio.com>
Diffstat (limited to 'giscanner/maintransformer.py')
-rw-r--r-- | giscanner/maintransformer.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py index 872395a0..bb79a5b3 100644 --- a/giscanner/maintransformer.py +++ b/giscanner/maintransformer.py @@ -784,6 +784,12 @@ class MainTransformer(object): tag = block.tags.get(TAG_RETURNS) else: tag = None + + if tag is not None and return_.type == ast.TYPE_NONE: + message.warn('%s: invalid return annotation' % (block.name,), + tag.position) + tag = None + self._apply_annotations_param_ret_common(parent, return_, tag) def _apply_annotations_params(self, parent, params, block): @@ -871,7 +877,6 @@ class MainTransformer(object): if block: self._apply_annotations_annotated(signal, block) - # We're only attempting to name the signal parameters if # the number of parameters (@foo) is the same or greater # than the number of signal parameters |