1
votes

I have C interface structs that look like this (non-relevant comment elements removed for brevity):

struct ArrayInterface {

    /**
     * @static
     * @fn Array *Array::arrayWithArray(const Array *array)
     * @memberof Array
     */
    Array *(*arrayWithArray)(const Array *array);

    /**
     * @static
     * @fn Array *Array::arrayWithObjects(ident obj, ...)
     * @memberof Array
     */
    Array *(*arrayWithObjects)(ident obj, ...);

    /**
     * @fn _Bool Array::containsObject(const Array *self, const ident obj)
     * @memberof Array
     */
    _Bool (*containsObject)(const Array *self, const ident obj);

    // ...
}

The @fn and @memberof are working as expected. The functions are indeed picked up by Doxygen as member functions. However, @static seems to be ignored, as the static functions are lumped in with the rest of the members in the generated documentation:

Notice arrayWithArray and arrayWithObjects are with containsObject

My Doxygen layout.xml includes both publicstaticmethods and publicmethods. My Doxyfile specifies EXTRACT_ALL and EXTRACT_STATIC as YES.

You would think that adding @static to those members would pull them into the Static Methods section of the Class documentation, yet as you can see, it doesn't.

I realize that I'm bending the limits of C and Doxygen here, but this still feels like a bug -- or maybe I'm doing something wrong.

1
C does not support classes or methods, only the compond data type struct and functions. A function pointer is not the same! - too honest for this site
Oh, I'm entirely aware! Here's the project, for more context: github.com/jdolan/objectively - jdolan
I don't see why this question warranted a downvote. The downvote guidelines are "This question does not show any research effort, or is not useful." I don't believe that is the case. Also, the Doxygen documentation clearly states that \memberof and \static are applicable (and in fact, intended for) the C language, where these attributes cannot be inferred from the source code. - jdolan
Maybe "Member Grouping" could help here. "Doxygen already automatically groups things together on type and protection level, but maybe you feel that this is not enough or that that default grouping is wrong", for this case "Member Grouping" is existing, see the "Grouping" Page in the Doxygen Documentation: stack.nl/~dimitri/doxygen/manual/grouping.html - gmug
Ah, that's great @gmug. Totally does the trick. I think I'd still like to raise this as a bug on the Doxygen mailing list, but member groups do provide a working solution for now. And now that I'm aware of them, I can think of a few other applications for them as well. Cheers. - jdolan

1 Answers

1
votes

I don't believe \static works at all.

struct _carData
{
  float mass;
};

/*! @class Car*/
typedef struct _carData *Car;

/*! @memberof Car*/
static *Car _carRegistry;
/*! @memberof Car*/
static size_t _carRegistrySize;

/*! @memberof Car*/
float CarGetMass(Car car);

/*! @static @memberof Car*/
void InitCarRegistry();

InitCarRegistry will be listed as an ordinary member of Car and not a static. This is despite the manual's very clear description of \static:

Indicates that the member documented by the comment block is static, i.e., it works on a class, instead of on an instance of the class.

This command is intended for use only when the language does not support the concept of static methods natively (e.g. C).

(emphasis mine)

I have opened a bug ticket for this, at https://bugzilla.gnome.org/show_bug.cgi?id=791832 edit: Doxygen's bug tracker has changed to Github. The ticket is now at https://github.com/doxygen/doxygen/issues/6298.

Also, from experimentation, the the workaround I've found that most closely approximates \static is \relates <classname>. Functions marked this way will show up in a separate section of the class's documentation, under "Related Functions". They will also show up in descendants of that class under "Related Functions inherited from ".