[gtk-doc] scan: correctly skip internal macros. Fixes #624199
- From: Stefan Kost <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] scan: correctly skip internal macros. Fixes #624199
- Date: Tue, 13 Jul 2010 13:12:41 +0000 (UTC)
commit 364ba12a0b147f8b0186c970efeb786e36c2879a
Author: Stefan Kost <ensonic users sf net>
Date: Tue Jul 13 16:06:28 2010 +0300
scan: correctly skip internal macros. Fixes #624199
If we come across an internal macro (starting with a '_') we still need to read
over it to not confuse the macro body with new declarations. Add a test.
gtkdoc-scan.in | 12 ++++++++++--
tests/bugs/src/tester.h | 16 ++++++++++++++++
2 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/gtkdoc-scan.in b/gtkdoc-scan.in
index a0a74b8..87df993 100755
--- a/gtkdoc-scan.in
+++ b/gtkdoc-scan.in
@@ -365,6 +365,7 @@ sub ScanHeader {
if (m/^\s*#\s*define\s+(\w+)/) {
$symbol = $1;
+ $decl = $_;
# We assume all macros which start with '_' are private, but
# we accept '_' itself which is the standard gettext macro.
# We also try to skip the first macro if it looks like the
@@ -377,11 +378,13 @@ sub ScanHeader {
&& (($symbol ne 'TRUE' && $symbol ne 'FALSE')
|| $MODULE eq 'glib'))
|| $symbol eq "_") {
- $decl = $_;
$in_declaration = "macro";
+ #print "DEBUG: Macro: $symbol\n";
+ } else {
+ $in_declaration = "macro-skip";
+ #print "DEBUG: skipping Macro: $symbol\n";
}
$first_macro = 0;
- #print "DEBUG: Macro: $symbol\n";
# TYPEDEF'D FUNCTIONS (i.e. user functions)
@@ -700,6 +703,11 @@ sub ScanHeader {
$in_declaration = "";
}
}
+ if ($in_declaration eq 'macro-skip') {
+ if ($decl !~ m/\\\s*$/) {
+ $in_declaration = "";
+ }
+ }
if ($in_declaration eq 'enum') {
if ($decl =~ m/\}\s*(\w+)?;\s*$/) {
diff --git a/tests/bugs/src/tester.h b/tests/bugs/src/tester.h
index 9aa2897..7e5053c 100644
--- a/tests/bugs/src/tester.h
+++ b/tests/bugs/src/tester.h
@@ -290,6 +290,22 @@ void bug_623968a(void);
void bug_623968b(void);
+#define _BUG_624199(struct_type, n_structs, func) \
+ (struct_type *) (__extension__ ({ \
+ gsize __n = (gsize) (n_structs); \
+ gsize __s = sizeof (struct_type); \
+ gpointer __p; \
+ if (__s == 1) \
+ __p = g_##func (__n); \
+ else if (__builtin_constant_p (__n) && \
+ (__s == 0 || __n <= G_MAXSIZE / __s)) \
+ __p = g_##func (__n * __s); \
+ else \
+ __p = g_##func##_n (__n, __s); \
+ __p; \
+ }))
+
+
const char * const * bug_624200a(void);
const char ** const bug_624200b(void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]