summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2019-07-09 11:03:34 -0400
committerXavier Claessens <xavier.claessens@collabora.com>2019-07-17 11:52:05 -0400
commita9b4a1a156ef39336cf7b51e6f91b37dfd31960d (patch)
tree0586d68d3c48aff3915dd5e43bc9b16b95bc339c
parent7aa34874b86e52984770703293e9c7ac40519559 (diff)
downloadgtk-doc-a9b4a1a156ef39336cf7b51e6f91b37dfd31960d.tar.gz
Fix parsing of g_set_object()
GLib wraps its name in parenthesis to avoid macro expansion. A few other functions does the same pattern in glib.
-rw-r--r--gtkdoc/scan.py4
-rw-r--r--tests/bugs/docs/tester-sections.txt1
-rw-r--r--tests/bugs/src/tester.h16
3 files changed, 19 insertions, 2 deletions
diff --git a/gtkdoc/scan.py b/gtkdoc/scan.py
index 4ffe5fe..ae4f866 100644
--- a/gtkdoc/scan.py
+++ b/gtkdoc/scan.py
@@ -128,7 +128,7 @@ CLINE_MATCHER = [
# 18-21: FUNCTIONS
None, # in ScanHeaderContent()
None, # in ScanHeaderContent()
- re.compile(r'^\s*([A-Za-z]\w*)\s*\('),
+ re.compile(r'^\s*\(?([A-Za-z]\w*)\)?\s*\('),
re.compile(r'^\s*\('),
# 22-23: STRUCTS
re.compile(r'^\s*struct\s+_?(\w+)\s*\*'),
@@ -417,7 +417,7 @@ def ScanHeaderContent(input_lines, decl_list, get_types, options):
(?:\b(?:extern|static|inline|G_INLINE_FUNC%s)\s*)*
(%s\w+) # 1: return type
([\s*]+(?:\s*(?:\*+|\bconst\b|\bG_CONST_RETURN\b))*)\s* # 2: .. cont'
- ([A-Za-z]\w*) # 3: name
+ \(?([A-Za-z]\w*)\)? # 3: name
\s*\(""" % (ignore_decorators, RET_TYPE_MODIFIER), re.VERBOSE)
PLINE_MATCHER[2] = re.compile(
diff --git a/tests/bugs/docs/tester-sections.txt b/tests/bugs/docs/tester-sections.txt
index 4329e37..e71d1bd 100644
--- a/tests/bugs/docs/tester-sections.txt
+++ b/tests/bugs/docs/tester-sections.txt
@@ -63,6 +63,7 @@ bug_783420
gst_play_marshal_BUFFER__BOXED
BUG_791928
_
+inline_func_with_macro
<SUBSECTION Standard>
<SUBSECTION Private>
GTKDOC_GNUC_CONST
diff --git a/tests/bugs/src/tester.h b/tests/bugs/src/tester.h
index 6e05de8..3ed3fc0 100644
--- a/tests/bugs/src/tester.h
+++ b/tests/bugs/src/tester.h
@@ -479,4 +479,20 @@ typedef struct {
guint index_plop;
} MyNotDeprecatedStruct;
+/**
+ * inline_func_with_macro:
+ * @obj: arg
+ *
+ * GLib has a few inline functions with a macro that has the same name. It puts
+ * the inline function name into parenthesis to avoid macro expansion.
+ * See g_set_object().
+ */
+static inline gboolean
+(inline_func_with_macro) (void *obj)
+{
+ return TRUE;
+}
+
+#define inline_func_with_macro(obj)
+
#endif // GTKDOC_TESTER_H