Search code examples
cattributesdoxygen

Doxygen does not parse __attribute__ correctly


I have some functions defined the following way:

 * @brief   Obtains the current time tick of the OS.
 *          This is a weak function and is intended to be overridden.
 * @return  In the weak version always 0. Otherwise should return the current
 *          OS time tick.
 */
__attribute__((__weak__)) osalUint_t osal_tickGetCurrent(void)
{
    return 0;
}

They are defined as "weak". When I generate the doxygen output for a c file with such a definition, the function is not parsed correctly.

enter image description here

Is there a way to make the Doxygen be __attribute__ aware when it comes to functions (and other objects too, such as structs)?


Solution

  • I used as source code:

    /// \file
    
    /**
     * @brief   Obtains the current time tick of the OS.
     *          This is a weak function and is intended to be overridden.
     * @return  In the weak version always 0. Otherwise should return the current
     *          OS time tick.
     */
    __attribute__((__weak__)) osalUint_t osal_tickGetCurrent(void)
    {
        return 0;
    }
    

    And as doxygen settings file (Doxyfile):

    QUIET = YES
    ENABLE_PREPROCESSING   = YES
    MACRO_EXPANSION        = YES
    PREDEFINED             = __attribute__(x)=
    

    and the result is:

    enter image description here