--- gtkdoc-mkdb.in.orig	2007-07-16 16:45:28.000000000 +0200
+++ gtkdoc-mkdb.in	2007-07-16 17:34:39.000000000 +0200
@@ -2822,7 +2822,7 @@
     my ($description, $return_desc, $return_start, $return_style);
     my ($since_desc, $stability_desc, $deprecated_desc);
     my $current_param;
-    my $ignore_returns;
+    my $ignore_broken_returns;
     my @params;
     while (<SRCFILE>) {
 	# Look for the start of a comment block.
@@ -2848,7 +2848,7 @@
 		$in_stability = 0;
 		$deprecated_desc = "";
 		$current_param = -1;
-		$ignore_returns = 0;
+		$ignore_broken_returns = 0;
 		@params = ();
 	    }
 	    next;
@@ -2886,6 +2886,7 @@
                     my $k;
 
                     #print "SECTION DOCS found in source for : '$real_symbol'\n";
+		    $ignore_broken_returns = 1;
                     for ($k = 0; $k <= $#params; $k += 2) {
                         #print "   '".$params[$k]."'\n";
 		        $params[$k] = "\L$params[$k]";
@@ -2957,7 +2958,7 @@
 	if ($in_return) {
 	    # If we find another valid returns line, we assume that the first
 	    # one was really part of the description.
-	    if (m%^\s*(returns:|return\s+value:)%i) {
+	    if (m/^\s*(returns:|return\s+value:)/i) {
 		$description .= $return_start . $return_desc;
 		$return_start = $1;
 		if ($return_style eq 'sane') {
@@ -2966,8 +2967,9 @@
 EOF
 		}
 		$return_style = 'sane';
+		$ignore_broken_returns = 1;
 		$return_desc = $';
-	    } elsif ($return_style ne 'sane' and m%^\s*(returns\b\s*)%i) {
+	    } elsif (!$ignore_broken_returns && m/^\s*(returns\b\s*)/i) {
 		$description .= $return_start . $return_desc;
 		$return_start = $1;
 		$return_style = 'broken';
@@ -2991,9 +2993,21 @@
 	}
 
 	if ($in_since) {
-	    if (m%^\s*(returns:|return\s+value:|returns\b\s*)%i) {
+	    if (m/^\s*(returns:|return\s+value:)/i) {
 		$return_start = $1;
-		$return_style = substr($1, -1) eq ':' ? 'sane' : 'broken';
+		if ($return_style eq 'sane') {
+		    print <<EOF
+WARNING: Multiple Returns for $symbol
+EOF
+		}
+		$return_style = 'sane';
+		$ignore_broken_returns = 1;
+		$return_desc = $';
+		$in_return = 1;
+		$in_since = 0;
+	    } elsif (!$ignore_broken_returns && m/^\s*(returns\b\s*)/i) {
+		$return_start = $1;
+		$return_style = 'broken';
 		$return_desc = $';
 		$in_return = 1;
 		$in_since = 0;
@@ -3012,9 +3026,21 @@
 	}
 
 	if ($in_stability) {
-	    if (m%^\s*(returns:|return\s+value:|returns\b\s*)%i) {
+	    if (m/^\s*(returns:|return\s+value:)/i) {
 		$return_start = $1;
-		$return_style = substr($1, -1) eq ':' ? 'sane' : 'broken';
+		if ($return_style eq 'sane') {
+		    print <<EOF
+WARNING: Multiple Returns for $symbol
+EOF
+		}
+		$return_style = 'sane';
+		$ignore_broken_returns = 1;
+		$return_desc = $';
+		$in_return = 1;
+		$in_stability = 0;
+	    } elsif (!$ignore_broken_returns && m/^\s*(returns\b\s*)/i) {
+		$return_start = $1;
+		$return_style = 'broken';
 		$return_desc = $';
 		$in_return = 1;
 		$in_stability = 0;
@@ -3033,9 +3059,21 @@
 	}
 
 	if ($in_deprecated) {
-	    if (m%^\s*(returns:|return\s+value:|returns\b\s*)%i) {
+	    if (m/^\s*(returns:|return\s+value:)/i) {
 		$return_start = $1;
-		$return_style = substr($1, -1) eq ':' ? 'sane' : 'broken';
+		if ($return_style eq 'sane') {
+		    print <<EOF
+WARNING: Multiple Returns for $symbol
+EOF
+		}
+		$return_style = 'sane';
+		$ignore_broken_returns = 1;
+		$return_desc = $';
+		$in_return = 1;
+		$in_deprecated = 0;
+	    } elsif (!$ignore_broken_returns && m/^\s*(returns\b\s*)/i) {
+		$return_start = $1;
+		$return_style = 'broken';
 		$return_desc = $';
 		$in_return = 1;
 		$in_deprecated = 0;
@@ -3059,7 +3097,7 @@
 	    # Get rid of 'Description:'
 	    s%^\s*Description:%%;
 
-	    if (!$ignore_returns && m%^\s*(returns:|return\s+value:)%i) {
+	    if (m/^\s*(returns:|return\s+value:)/i) {
 		$return_start = $1;
 		if ($return_style eq 'sane') {
 		    print <<EOF
@@ -3067,25 +3105,21 @@
 EOF
 		}
 		$return_style = 'sane';
+		$ignore_broken_returns = 1;
 		$return_desc = $';
 		$in_return = 1;
 		next;
-	    }
-	    elsif (!$ignore_returns
-		   && $return_style ne 'sane'
-		   && m%^\s*(returns\b\s*)%i) {
+	    } elsif (!$ignore_broken_returns && m/^\s*(returns\b\s*)/i) {
 		$return_start = $1;
 		$return_style = 'broken';
 		$return_desc = $';
 		$in_return = 1;
 		next;
-	    }
-	    elsif (m%^\s*since:%i) {
+	    } elsif (m%^\s*since:%i) {
 		$since_desc = $';
 		$in_since = 1;
 		next;
-	    }
-	    elsif (m%^\s*deprecated:%i) {
+	    } elsif (m%^\s*deprecated:%i) {
 		$deprecated_desc = $';
 		$in_deprecated = 1;
 		next;
@@ -3114,7 +3148,8 @@
 		$param_name = "Varargs";
 	    }
 	    if ("\L$param_name" eq "returns") {
-	      $ignore_returns = 1;
+		$return_style = 'sane';
+		$ignore_broken_returns = 1;
 	    }
 	    push (@params, $param_name);
 	    push (@params, $');
