After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 746118 - gtkdoc-scan: fix regex for get_type() functions
gtkdoc-scan: fix regex for get_type() functions
Status: RESOLVED FIXED
Product: gtk-doc
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: 1.22
Assigned To: gtk-doc maintainers
gtk-doc maintainers
Depends on:
Blocks: 746119
 
 
Reported: 2015-03-12 23:04 UTC by Allison Karlitskaya (desrt)
Modified: 2015-04-17 18:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtkdoc-scan: fix regex for get_type() functions (1.51 KB, patch)
2015-03-12 23:04 UTC, Allison Karlitskaya (desrt)
none Details | Review
gtkdoc-scan: fix regex for get_type() functions (2.66 KB, patch)
2015-03-13 11:37 UTC, Allison Karlitskaya (desrt)
committed Details | Review
gtkdoc-scan: fix regex for get_type() functions (2.67 KB, patch)
2015-04-17 18:51 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
committed Details | Review

Description Allison Karlitskaya (desrt) 2015-03-12 23:04:41 UTC
This regexp was apparently looking for "(void)" or "()" but in fact, due
to improper order of operations, would match any declaration with either
of "(void" or ")" in it (ie: everything).

Since nobody is really doing '()' anyway, just make it match '(void)'.

This fixes the inappropriate matching of g_io_extension_get_type().
Comment 1 Allison Karlitskaya (desrt) 2015-03-12 23:04:44 UTC
Created attachment 299247 [details] [review]
gtkdoc-scan: fix regex for get_type() functions
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2015-03-13 09:50:15 UTC
If nobody is doing '()', why is g_io_extension_get_type() doing it then? Do you have an example where this was causing trouble?
Comment 3 Allison Karlitskaya (desrt) 2015-03-13 10:11:06 UTC
GIOExtensionType is not a GObject.  It has this function:

  GType   g_io_extension_get_type     (GIOExtension  *extension);

which (trivially) matches the right side of /(void|)/, ie: ")".

If you like, I can do another patch for (void)|(). but as mentioned, I'm not sure anyone is using ().
Comment 4 Stefan Sauer (gstreamer, gtkdoc dev) 2015-03-13 10:22:09 UTC
Lets go with (void)|() as that was the original intend. I agree that people probably don't use (), but you never know.
Comment 5 Allison Karlitskaya (desrt) 2015-03-13 11:37:19 UTC
Created attachment 299303 [details] [review]
gtkdoc-scan: fix regex for get_type() functions

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().
Comment 6 Stefan Sauer (gstreamer, gtkdoc dev) 2015-04-17 18:50:56 UTC
The following fix has been pushed:
e8adef5 gtkdoc-scan: fix regex for get_type() functions
Comment 7 Stefan Sauer (gstreamer, gtkdoc dev) 2015-04-17 18:51:06 UTC
Created attachment 301869 [details] [review]
gtkdoc-scan: fix regex for get_type() functions

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().