summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2015-03-12 18:50:50 -0400
committerRyan Lortie <desrt@desrt.ca>2015-03-13 07:39:04 -0400
commit6dccb41de945bd7b3521e1e0b651516356d67c57 (patch)
tree640452c8898010a3c9eb32330c766fc3c3a3dd25
parent57cd5c305196decf99b40d3b073b7507524504ab (diff)
downloadgtk-doc-wip/desrt/fixes-for-glib.tar.gz
gtkdoc-scan: fix regex for get_type() functionswip/desrt/fixes-for-glib
The regexp /(void|)/ was apparently trying to look for "(void)" or "()", but in fact, the parens here were only acting as (redundant) grouping, so the expression would match any string containing either "void" or "", which is every string. It turns out that we don't want to look for parens anyway, since they are already stripped out above. We do want to look for exactly "void" or "", however, so add ^ and $. Unfortunately, some code above also replaces all whitespace surrounding newlines with a single space character, and a trailing newline is left at the end of the declaration by another regular expression above, resulting in seeing "void " at this point. Fix that expression up to also clean up the newline at the end, by adding /s as a regexp flag. This fixes the inappropriate matching of non-void functions, such as g_io_extension_get_type(). https://bugzilla.gnome.org/show_bug.cgi?id=746118
-rwxr-xr-xgtkdoc-scan.in4
1 files changed, 2 insertions, 2 deletions
diff --git a/gtkdoc-scan.in b/gtkdoc-scan.in
index a45744a..567b5b0 100755
--- a/gtkdoc-scan.in
+++ b/gtkdoc-scan.in
@@ -774,7 +774,7 @@ sub ScanHeader {
# Note that sometimes functions end in ') G_GNUC_PRINTF (2, 3);' or
# ') __attribute__ (...);'.
if ($in_declaration eq 'function') {
- if ($decl =~ s/\)\s*(G_GNUC_.*|.*DEPRECATED.*|${IGNORE_DECORATORS}\s*|__attribute__\s*\(.*\)\s*)*;.*$//) {
+ if ($decl =~ s/\)\s*(G_GNUC_.*|.*DEPRECATED.*|${IGNORE_DECORATORS}\s*|__attribute__\s*\(.*\)\s*)*;.*$//s) {
if ($internal == 0) {
$decl =~ s%/\*.*?\*/%%gs; # remove comments.
#$decl =~ s/^\s+//; # remove leading whitespace.
@@ -786,7 +786,7 @@ sub ScanHeader {
print DECL "<FUNCTION>\n<NAME>$symbol</NAME>\n$deprecated<RETURNS>$ret_type</RETURNS>\n$decl\n</FUNCTION>\n";
if ($REBUILD_TYPES) {
# check if this looks like a get_type function and if so remember
- if (($symbol =~ m/_get_type$/) && ($ret_type =~ m/GType/) && ($decl =~ m/(void|)/)) {
+ if (($symbol =~ m/_get_type$/) && ($ret_type =~ m/GType/) && ($decl =~ m/^(void|)$/)) {
@TRACE@("Adding get-type: [$ret_type] [$symbol] [$decl]\tfrom $input_file");
push (@get_types, $symbol);
}