breathe icon indicating copy to clipboard operation
breathe copied to clipboard

doxygenfunction: Cannot find function "" when declared in C file

Open jaenrig-ifx opened this issue 3 years ago • 5 comments

Hi there,

I have an using sphinx + breathe + exhale, in a C project with basically 2 files:

  • file.h
  • file.c

I don´t find a way to get the .c functions declared as static to be properly generated in the documentation. They always throw the same warning:

WARNING: doxygenfunction: Cannot find function "functionxxx" in doxygen xml output for project "myProject" from directory: build/xml/

The native doxygen html documentation is properly showing these functions when EXTRACT_STATIC is set to YES for doxygen. The xml has those functions present. I have tried the following configuration as well in the conf.py:

breathe_domain_by_extension = {
        "h" : "c"
        }

The toolchain versions :

  • exhale 0.2.4
  • sphinx 4.3.1
  • breathe 4.31
  • doxygen 1.9.3

Any idea how to get that running?

Thanks!

jaenrig-ifx avatar Jan 24 '22 12:01 jaenrig-ifx

Is the project publicly available to get concrete in where the issue may be? And if so, do you have instructions for how to reproduce the problem. Otherwise, can you provide a minimum example project which reproduces the problem?

jakobandersen avatar Feb 06 '22 12:02 jakobandersen

Somewhat edited but the gist of it:

file.c

static void foo(UByte bar);

/*!
    foo

    \param bar this is bar
*/

static void foo(UByte bar)
{
    return bar;
}

Doxyfile

EXTRACT_ALL            = YES
EXTRACT_STATIC         = YES

doxygen bild

docs.rst

.. doxygenfunction:: foo
   :project: auto-nail-mcu

result

Warning, treated as error: path\to\docs.rst:13:doxygenfunction: Cannot find function "foo" in doxygen xml output for project "temp" from directory: ../doxygen/xml/

the xml file

<?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.9.5" xml:lang="en-US">
  <compounddef id="file_8c" kind="file" language="C++">
    <compoundname>file.c</compoundname>
      <sectiondef kind="func">
      <memberdef kind="function" id="file_8c_1a7f01d41bafbbd6b4a78ff0408cbd0ef0" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>static void foo</definition>
        <argsstring>(UByte bar)</argsstring>
        <name>foo</name>
        <param>
          <type>UByte</type>
          <declname>bar</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>foo</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>bar</parametername>
</parameternamelist>
<parameterdescription>
<para>this is bar </para>
</parameterdescription>
</parameteritem>
</parameterlist>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="file.c" line="10" column="13" bodyfile="file.c" bodystart="10" bodyend="13" declfile="file.c" declline="1" declcolumn="13"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="gem__app_8c_1a7f01d41bafbbd6b4a78ff0408cbd0ef0" kindref="member">foo</ref>(UByte<sp/>bar);</highlight></codeline>
<codeline lineno="2"><highlight class="normal"></highlight></codeline>
<codeline lineno="3"><highlight class="normal"></highlight></codeline>
<codeline lineno="10"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="gem__app_8c_1a7f01d41bafbbd6b4a78ff0408cbd0ef0" kindref="member">foo</ref>(UByte<sp/>bar)</highlight></codeline>
<codeline lineno="11"><highlight class="normal">{</highlight></codeline>
<codeline lineno="12"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>bar;</highlight></codeline>
<codeline lineno="13"><highlight class="normal">}</highlight></codeline>
    </programlisting>
    <location file="file.c"/>
  </compounddef>
</doxygen>

Knaifhogg avatar Oct 06 '22 07:10 Knaifhogg

Have you set

EXTRACT_STATIC = YES

in your Doxygen config?

schlatterbeck avatar Dec 31 '22 18:12 schlatterbeck

The construct of how Breathe expects to use C++ files with classes, not C-style where you might have static functions defined internal to the implementation file.

To include both, you need to set the variable: breathe_implementation_filename_extensions to include your c file, but it can make the system angry.

smitchell7 avatar Mar 24 '23 20:03 smitchell7

Does this mean there is no way to document static functions in a *.c file with breathe?

daltonv avatar Nov 07 '23 15:11 daltonv