mathog
mathog

Reputation: 345

Same line documentation of typedefs with Doxygen

I have a C header file with a lot of typedef's and #defines. I would like to be able to get Doxygen to accept comments on the same line, like this:

typedef uint32_t   U_NUM_LOGPLTNTRY;        //!< Number of U_LOGPLTENTRY
typedef uint32_t   U_NUM_RECTL;             //!< Number of U_RECTL

and this:

#define U_SRCCOPY     0xcc0020  //!< info for srccopy
#define U_SRCPAINT    0xee0086  //!< info for srcpaint

However, neither of these forms work. For typedef the comment is applied to the following line. For #defines the comment vanishes into the ether. If a //! line precedes a #define then that comment is associated with the following #define. But I really do not want to have to offset all the comments by one line!

Is there a Doxygen syntax to do this? I am using Doxygen 1.8.1.1 running on Windows.

Upvotes: 1

Views: 3736

Answers (2)

mathog
mathog

Reputation: 345

I have not yet worked down all the way through the real include file, which is quite large, but in a small test file this format correctly associates group description and per line description:

/** \defgroup ABC Description of ABC group
  More information on the ABC group.
  And yet more.
  @{
*/
typedef uint32_t   U_ONE_NAME;        //!< One name
typedef uint32_t   U_TWO_NAME;        //!< Two name
/** @} */

The original file had a "group description" line like:

//! Describe the next few lines

before lines which were a logical group. That format wasn't right - it associated the description with only the next line, and perhaps too many of them eventually led to the shift issue.

Upvotes: 0

bta
bta

Reputation: 45087

This works for me. My guess is that the problem is being caused by something above the snippet you are showing us. If there's a Doxygen comment block immediately above the typedef, Doxygen could be associating it with the typdef instead of the inline comment. Take a look at the surrounding Doxygen comments and make sure nothing like this is going on.

You can also try placing the typedefs in a header by themselves and see if Doxygen processes them correctly. If so, then the problem is most likely something in the file above the affected typedefs.

Also, is Doxygen producing any useful output on the command-line? If not, try setting the following in your .doxyfile:

  • QUIET=NO
  • WARNINGS=YES
  • WARN_IF_DOC_ERROR=YES

Upvotes: 3

Related Questions