[gtk-doc] parsing: support return value types like "long int". Fixes #602518
- From: Stefan Kost <stefkost src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk-doc] parsing: support return value types like "long int". Fixes #602518
- Date: Wed, 25 Nov 2009 08:48:46 +0000 (UTC)
commit 2c5cdf51ac727e189d9a7cc909db8b1f4551f39d
Author: Stefan Kost <ensonic users sf net>
Date: Wed Nov 25 10:47:13 2009 +0200
parsing: support return value types like "long int". Fixes #602518
Fix the regexps to handle such constructs. Also add a few tests that cover the
reported case and similar ones.
gtkdoc-mkdb.in | 4 ++--
gtkdoc-scan.in | 9 +++++----
tests/bugs/docs/tester-sections.txt | 3 +++
tests/bugs/src/tester.c | 32 ++++++++++++++++++++++++++++++++
tests/bugs/src/tester.h | 5 +++++
5 files changed, 47 insertions(+), 6 deletions(-)
---
diff --git a/gtkdoc-mkdb.in b/gtkdoc-mkdb.in
index fea19c5..27408eb 100755
--- a/gtkdoc-mkdb.in
+++ b/gtkdoc-mkdb.in
@@ -1642,8 +1642,8 @@ sub OutputFunction {
my $id = &CreateValidSGMLID ($symbol);
my $condition = &MakeConditionDescription ($symbol);
- # Take out the return type $1 $3 $4
- $declaration =~ s/<RETURNS>\s*((const\s+|G_CONST_RETURN\s+|unsigned\s+|struct\s+|enum\s+)*)(\w+)(\s*\**\s*(const|G_CONST_RETURN)?\s*\**\s*(restrict)?\s*)<\/RETURNS>\n//;
+ # Take out the return type $1 $3 $4
+ $declaration =~ s/<RETURNS>\s*((const\s+|G_CONST_RETURN\s+|unsigned\s+|long\s+|short\s+|struct\s+|enum\s+)*)(\w+)(\s*\**\s*(const|G_CONST_RETURN)?\s*\**\s*(restrict)?\s*)<\/RETURNS>\n//;
my $type_modifier = defined($1) ? $1 : "";
my $type = $3;
my $pointer = $4;
diff --git a/gtkdoc-scan.in b/gtkdoc-scan.in
index 1e14f82..2160b35 100755
--- a/gtkdoc-scan.in
+++ b/gtkdoc-scan.in
@@ -486,15 +486,16 @@ sub ScanHeader {
# We assume that functions which start with '_' are private, so
# we skip them.
- # $1 $2
- } elsif (m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\b\s*)*((?:const\s+|G_CONST_RETURN\s+|unsigned\s+|struct\s+|enum\s+)*\w+(?:\**\s+\**(?:const|G_CONST_RETURN))?(?:\s+|\s*\*+))\s*\(\s*\*+\s*([A-Za-z]\w*)\s*\)\s*\(/o) {
+ # $1 $2
+ } elsif (m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\b\s*)*((?:const\s+|G_CONST_RETURN\s+|unsigned\s+|long\s+|short\s+|struct\s+|enum\s+)*\w+(?:\**\s+\**(?:const|G_CONST_RETURN))?(?:\s+|\s*\*+))\s*\(\s*\*+\s*([A-Za-z]\w*)\s*\)\s*\(/o) {
$ret_type = $1;
$symbol = $2;
$decl = $';
- #print "DEBUG: FunctionPointer: $symbol, Returns: $ret_type\n";
+ #print "DEBUG: internal Function: $symbol, Returns: $ret_type\n";
$in_declaration = "function";
- } elsif (m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\b\s*)*((?:const\s+|G_CONST_RETURN\s+|unsigned\s+|struct\s+|enum\s+)*\w+(?:\**\s+\**(?:const|G_CONST_RETURN))?(?:\s+|\s*\*+))\s*([A-Za-z]\w*)\s*\(/o) {
+ # $1 $2
+ } elsif (m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\b\s*)*((?:const\s+|G_CONST_RETURN\s+|unsigned\s+|long\s+|short\s+|struct\s+|enum\s+)*\w+(?:\**\s+\**(?:const|G_CONST_RETURN))?(?:\s+|\s*\*+))\s*([A-Za-z]\w*)\s*\(/o) {
$ret_type = $1;
$symbol = $2;
$decl = $';
diff --git a/tests/bugs/docs/tester-sections.txt b/tests/bugs/docs/tester-sections.txt
index 66792e6..b2832ac 100644
--- a/tests/bugs/docs/tester-sections.txt
+++ b/tests/bugs/docs/tester-sections.txt
@@ -25,6 +25,9 @@ bug_552602
bug_554833
bug_574654a
bug_574654b
+bug_602518a
+bug_602518b
+bug_602518c
<SUBSECTION Standard>
<SUBSECTION Private>
bug_554833_new
diff --git a/tests/bugs/src/tester.c b/tests/bugs/src/tester.c
index a60db02..344463e 100644
--- a/tests/bugs/src/tester.c
+++ b/tests/bugs/src/tester.c
@@ -150,3 +150,35 @@ void bug_580300c_get_type() { }
int bug_580300d_get_type() { }
+/**
+ * bug_602518a:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=602518
+ *
+ * Returns: result
+ */
+long int bug_602518a(void) {
+ return (long int)0;
+}
+
+/**
+ * bug_602518b:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=602518
+ *
+ * Returns: result
+ */
+unsigned long int bug_602518b(void) {
+ return (unsigned long int)0;
+}
+
+/**
+ * bug_602518c:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=602518
+ *
+ * Returns: result
+ */
+unsigned int bug_602518c(void) {
+ return (unsigned int)0;
+}
diff --git a/tests/bugs/src/tester.h b/tests/bugs/src/tester.h
index 7afc725..e637755 100644
--- a/tests/bugs/src/tester.h
+++ b/tests/bugs/src/tester.h
@@ -191,5 +191,10 @@ void bug_580300b_get_type(gint a);
void bug_580300c_get_type();
extern int bug_580300d_get_type();
+
+long int bug_602518a(void);
+unsigned long int bug_602518b(void);
+unsigned int bug_602518c(void);
+
#endif // GTKDOC_TESTER_H
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]