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 759281 - Doxygen parser confused by C++11 attributes
Doxygen parser confused by C++11 attributes
Status: RESOLVED FIXED
Product: doxygen
Classification: Other
Component: general
1.8.10
Other Linux
: Normal normal
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
Depends on:
Blocks:
 
 
Reported: 2015-12-10 00:27 UTC by Jonathan Wakely
Modified: 2016-09-30 19:07 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jonathan Wakely 2015-12-10 00:27:39 UTC
Doxygen doesn't have any way to document unnamed parameters, but giving them a name leads to compiler warnings. An obvious solution is to name the parameter but mark it unused, but doxygen can't cope with that either:

///  S is a class
struct S
{
  /** @brief blah blah
   *  @param i an unused argument
   */
  void f(int i [[gnu:unused]]) { }
};



/tmp/doxygen/include/un.cpp:4: warning: argument 'i' of command @param is not found in the argument list of S::f(int i][[gnu:unused])


There's no warning if the code looks like this:

  void f(int [[gnu:unused]] i) { }

But that's not the right syntax, because there the attribute applies to the type, not the parameter.

Again, Doxygen should use a conforming parser such as libclang, rather than maintaining its own.
Comment 1 Dimitri van Heesch 2015-12-13 12:17:33 UTC
I'll add support for C++11 style attributes. 
Should be fixed in the next GIT update.

I agree that using libclang for C++ parser support would be an improvement, but it is not so easy and the last time I looked the API had blocking limitations (partial code parsing, macros, typedef handling...)
Comment 2 Dimitri van Heesch 2015-12-30 10:19:22 UTC
This bug was previously marked ASSIGNED, which means it should be fixed in
doxygen version 1.8.11. Please verify if this is indeed the case. Reopen the
bug if you think it is not fixed and please include any additional information 
that you think can be relevant (preferably in the form of a self-contained example).
Comment 3 Thomas Braun 2016-09-30 19:07:55 UTC
What happens with the C++11 attribute? Is it stored in e.g the XML output? I'd like to include it in the output.

$cat test.h 
[[ threadsafe ]] MyFunc();

echo "GENERATE_XML = YES" | doxygen -

gives

<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.13">
  <compounddef id="test_8h" kind="file" language="C++">
    <compoundname>test.h</compoundname>
      <sectiondef kind="func">
      <memberdef kind="function" id="test_8h_1a81f2b307f2171fc964cf96a04341579a" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type></type>
        <definition>MyFunc</definition>
        <argsstring>()</argsstring>
        <name>MyFunc</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="test.h" line="1" column="1"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="normal">[[<sp/>threadsafe<sp/>]]<sp/>MyFunc();</highlight></codeline>
    </programlisting>
    <location file="test.h"/>
  </compounddef>
</doxygen>