Xophmeister
Xophmeister

Reputation: 9211

Doxygen can't parse C function pointer signature

Doxygen (1.8.6) won't parse this, for me:

/**
  @fn dynArray* dynMap(dynArray* array, void*(*callback)(void**, size_t, dynArray*))
  @brief foo
  @param array    bar
  @param callback baz

  blah blah blah
*/
extern dynArray* dynMap(dynArray*, void*(*)(void**, size_t, dynArray*));

Am I doing something wrong, or is this a bug? I notice that if I remove the argument names from the documentation, it will compile, albeit incorrectly (it mangles the parameters). However, it does work if I match the documentation to the signature exactly:

/**
  @fn dynArray* dynMap(dynArray* array, void*(*callback)(void**, size_t, dynArray*))
  @brief foo
  @param array    bar
  @param callback baz

  blah blah blah
*/
extern dynArray* dynMap(dynArray* array, void*(*callback)(void**, size_t, dynArray*));

However, then I get array and callback in the type definitions for the function, which isn't particularly satisfying...

Upvotes: 0

Views: 1880

Answers (1)

doxygen
doxygen

Reputation: 14869

Why do you use @fn while the symbol you want to document is right after the comment block? That is not needed at all.

If you somehow cannot suppress the urge to use @fn then you should indeed match the arguments with the declaration (or you could move the comment block to the function definition).

See also http://www.doxygen.org/manual/docblocks.html#structuralcommands for more info

When working with function pointers it is usually a good practice to typedef them.

Upvotes: 1

Related Questions