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 682401 - Incorrect anchor generated for GBoxed typedef in the same file as a class
Incorrect anchor generated for GBoxed typedef in the same file as a class
Status: RESOLVED OBSOLETE
Product: gtk-doc
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-doc maintainers
gtk-doc maintainers
Depends on:
Blocks:
 
 
Reported: 2012-08-21 21:41 UTC by Philip Withnall
Modified: 2018-05-22 13:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Remove generation of anchor elements (4.21 KB, patch)
2012-08-21 21:44 UTC, Philip Withnall
none Details | Review
changes causes by the patch (1.27 KB, application/octet-stream)
2012-08-22 13:56 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
  Details

Description Philip Withnall 2012-08-21 21:41:57 UTC
If a single C file/H file pair defines a GObject class as normal, but also has a typedef of a struct which is registered as a GBoxed type with GObject, an extraneous <anchor> element will be generated for the typedef in the gtk-doc XML for that file. It’s extraneous because a <refsect> will also be generated for the typedef, with the same ID. The IDs will clash.

For example, the following H file (full version here: http://git.gnome.org/browse/totem-pl-parser/tree/plparse/totem-pl-parser.h):

typedef struct {
	…
} TotemPlParserClass;

/**
 * TotemPlParserMetadata:
 *
 * …
 */
typedef GHashTable TotemPlParserMetadata;

with the following C file (full version here: http://git.gnome.org/browse/totem-pl-parser/tree/plparse/totem-pl-parser.c):

GType
totem_pl_parser_metadata_get_type (void)
{
	…
		GType g_define_type_id = g_boxed_type_register_static (
		    g_intern_static_string ("TotemPlParserMetadata"),
		    (GBoxedCopyFunc) g_hash_table_ref,
		    (GBoxedFreeFunc) g_hash_table_unref);
	…
}

will generate the following XML:

<refsynopsisdiv id="TotemPlParser.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>
<anchor id="TotemPlParserMetadata"/>
<synopsis>
#include &lt;totem-pl-parser.h&gt;
…
<refsect2 id="TotemPlParserMetadata" role="typedef">
<title>TotemPlParserMetadata</title>
<indexterm zone="TotemPlParserMetadata"><primary>TotemPlParserMetadata</primary></indexterm>
<programlisting>typedef GHashTable TotemPlParserMetadata;
</programlisting>
</refsect2>
Comment 1 Philip Withnall 2012-08-21 21:44:40 UTC
Created attachment 222082 [details] [review]
Remove generation of anchor elements

This patch fixes the issue for me. I can’t see what else can cause an <anchor> element to be generated apart from an object, and objects are guaranteed to generate a <refsect> as well. Therefore, removing <anchor> generation seems (to me) to be the best way to fix it. I’m probably missing something.
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2012-08-22 13:53:44 UTC
See also https://bugzilla.gnome.org/show_bug.cgi?id=593282#c5
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2012-08-22 13:56:24 UTC
Created attachment 222151 [details]
changes causes by the patch

Applying the patch causes this delta in the test suite. I think it is for the better actually. I'll try this for more pages.
Comment 4 Stefan Sauer (gstreamer, gtkdoc dev) 2012-08-22 13:58:00 UTC
Sorry, I have to correct myself. With your patch applied, I can't like to GEnums and GBoxed types anymore :/
Comment 5 Philip Withnall 2012-08-23 23:27:19 UTC
(In reply to comment #4)
> Sorry, I have to correct myself. With your patch applied, I can't like to
> GEnums and GBoxed types anymore :/

Why not? Shouldn’t a <refsect> be generated for each GEnum and GBoxed with the right ID?
Comment 6 Stefan Sauer (gstreamer, gtkdoc dev) 2012-08-24 09:57:16 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Sorry, I have to correct myself. With your patch applied, I can't like to
> > GEnums and GBoxed types anymore :/
> 
> Why not? Shouldn’t a <refsect> be generated for each GEnum and GBoxed with the
> right ID?

Yes, it should. But this is not implemented right now and I am really short on spare time for this :/.
Comment 7 GNOME Infrastructure Team 2018-05-22 13:06:31 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk-doc/issues/22.