From c291bce772a09af1e884a064ceaa736712fe36a4 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Mon, 29 Oct 2012 08:32:08 +0100 Subject: [PATCH] giscanner: fix DocBlock().comment If there is no comment block description, DocBlock().comment should be None. This results in the removal of unneeded blank lines in the output of DocBlock().to_gtk_doc and hence the .c files generated by misc/update-glib-annotations.py https://bugzilla.gnome.org/show_bug.cgi?id=688897 --- gir/gio-2.0.c | 2 -- gir/glib-2.0.c | 6 ------ gir/gobject-2.0.c | 4 ---- giscanner/annotationparser.py | 9 ++++----- giscanner/maintransformer.py | 4 ++-- 5 files changed, 6 insertions(+), 19 deletions(-) diff --git a/gir/gio-2.0.c b/gir/gio-2.0.c index 1c64ec1..0ebadc7 100644 --- a/gir/gio-2.0.c +++ b/gir/gio-2.0.c @@ -7377,8 +7377,6 @@ * @title: GTlsBackend * @short_description: TLS backend implementation * @include: gio/gio.h - * - * */ diff --git a/gir/glib-2.0.c b/gir/glib-2.0.c index 51805c4..24ed46e 100644 --- a/gir/glib-2.0.c +++ b/gir/glib-2.0.c @@ -7319,8 +7319,6 @@ * SECTION:shell * @title: Shell-related Utilities * @short_description: shell-like commandline handling - * - * */ @@ -7328,8 +7326,6 @@ * SECTION:spawn * @Short_description: process launching * @Title: Spawning Processes - * - * */ @@ -16083,8 +16079,6 @@ /** * g_io_channel_error_quark: * - * - * * Returns: the quark used as %G_IO_CHANNEL_ERROR */ diff --git a/gir/gobject-2.0.c b/gir/gobject-2.0.c index dc718ce..5d6f3e5 100644 --- a/gir/gobject-2.0.c +++ b/gir/gobject-2.0.c @@ -5473,8 +5473,6 @@ * g_value_peek_pointer: * @value: An initialized #GValue structure. * - * - * * Returns: (transfer none): the value contents as pointer. This function asserts that g_value_fits_pointer() returned %TRUE for the passed in value. This is an internal function introduced mainly for C marshallers. */ @@ -5917,8 +5915,6 @@ /** * g_variant_get_gtype: * - * - * * Since: 2.24 * Deprecated: 2.26 */ diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py index 8c48d0a..393ef38 100644 --- a/giscanner/annotationparser.py +++ b/giscanner/annotationparser.py @@ -389,9 +389,10 @@ class DocBlock(object): lines[0] += options for param in self.params.values(): lines.append(param.to_gtk_doc_param()) - lines.append('') - for l in self.comment.split('\n'): - lines.append(l) + if self.comment: + lines.append('') + for l in self.comment.split('\n'): + lines.append(l) if self.tags: lines.append('') for tag in self.tags.values(): @@ -1105,8 +1106,6 @@ class AnnotationParser(object): # intended. Strip those. if comment_block.comment: comment_block.comment = comment_block.comment.strip() - else: - comment_block.comment = '' for tag in comment_block.tags.values(): self._clean_comment_block_part(tag) diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py index 34d153b..67168d6 100644 --- a/giscanner/maintransformer.py +++ b/giscanner/maintransformer.py @@ -225,7 +225,7 @@ usage is void (*_gtk_reserved1)(void);""" section_name = 'SECTION:' + name.lower() block = self._blocks.get(section_name) if block: - node.doc = block.comment + node.doc = block.comment if block.comment else '' if isinstance(node, (ast.Class, ast.Interface)): for prop in node.properties: self._apply_annotations_property(node, prop) @@ -600,7 +600,7 @@ usage is void (*_gtk_reserved1)(void);""" if block is None: return - node.doc = block.comment + node.doc = block.comment if block.comment else '' since_tag = block.get_tag(TAG_SINCE) if since_tag is not None: -- 2.7.4