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 753052 - _() causes element a: validity error : ID idx already defined
_() causes element a: validity error : ID idx already defined
Status: RESOLVED FIXED
Product: gtk-doc
Classification: Platform
Component: general
1.24
Other Linux
: Normal normal
: 1.26
Assigned To: gtk-doc maintainers
gtk-doc maintainers
Depends on:
Blocks:
 
 
Reported: 2015-07-30 11:38 UTC by Yeti
Modified: 2016-03-24 18:10 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Yeti 2015-07-30 11:38:12 UTC
gtkdoc-scan used to skips all functions and macros starting with an underscore as private.  Except that code contains a special exception for the _() macro which is therefore included:

                # We assume all macros which start with '_' are private, but
                # we accept '_' itself which is the standard gettext macro.

However, if the macro actually is defined, this leads to the error

    element a: validity error : ID idx already defined

during index construction because the following snippet is generated in the index (with specific library/file name obviously varying):

<div class="index">
<div class="titlepage"><div><div><h1 class="title">
<a name="api-index-all"></a>Index of all symbols</h1></div></div></div>
<a name="idx"></a><a name="idx"></a><h3 class="title"></h3>
<dt>
<a class="link" href="libgwyddion-gwymacros.html#gettext-macro" title="_()">_</a>, macro in <a class="link" href="libgwyddion-gwymacros.html" title="gwymacros">gwymacros</a>

That is the ID "idx" is used both for the entire index and the portion with symbols starting with _.

Personally, I do not see much point in documenting the standard gettext macro _() in Gtk+ packages.  But if it is to stay the ID generation logic needs to be improved to avoid the ID clash.
Comment 1 Yeti 2015-07-30 11:39:49 UTC
Edit: the first sentence does not make sense, sorry.  It should start

gtkdoc-scan skips all...
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2015-08-16 10:11:53 UTC
When you you say "However, if the macro actually is defined, this leads to the error" you mean defined as in
 #define _(String) gettext(String)
or do you mean that the macros is also documented? personally I exclude those from the docs using this in the Makefile.am
IGNORE_HFILES=core_private.h
having the gettext macros in a separate header that is only included from .c files in the lib also make sense as this makes it easy to not install this header (noinst_HEADERS).
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2015-08-16 10:12:45 UTC
Regardless, I'll make a patch to not use the same index id twice. This could also happen if someone defines a macro "A()".
Comment 4 Stefan Sauer (gstreamer, gtkdoc dev) 2016-03-24 18:00:28 UTC
commit c7c56747e070b8d5e203a3be1fc75be014c6465d
Author: Stefan Sauer <ensonic@users.sf.net>
Date:   Thu Mar 24 18:56:13 2016 +0100

    mkdb: avoid duplicated id='idx'
    
    We're stripping leading '_' from names when sorting them into buckets. This
    would leave us with an empty buckname name for the macro "_".
    
    Fixes #753052
Comment 5 Stefan Sauer (gstreamer, gtkdoc dev) 2016-03-24 18:10:42 UTC
commit 070acc51771b0e9b839d72264889ebbc1c2e6f13
Author: Stefan Sauer <ensonic@users.sf.net>
Date:   Thu Mar 24 19:06:10 2016 +0100

    scan: remove special case for '_' macro
    
    As discussed in #753052, the special case for '_' is not very useful. The '_'
    macro is not part of the library API anyway. Further this is inconsitent w.r.t
    the _N() macros and others. Hence remove the special case.