1

In my current project I defined some macros that serve as hints for parameters, return values and the relationship between them.

For example notnull is for pointers that are not null. But there are also parameterized hints, like issizeof(__T) to indicate that a size_t should be filled with the size of the type __T. Similar, GenericPtr(__T) indicates that a void* is returned, but semantically it is a pointer to a __T.

They are defined like this:

#define notnull
#define issizeof(__T)
#define GenericPtr(__T) (void*)

Now I want to use them for a malloc-like function like this:

/// @returns a newly allocated memory region for a T
/// @note Terminates the program on failure
notnull GenericPtr(T) myMalloc(issizeof(T) size_t s);

Now when I run doxygen, it sees notnull as the type and GenericPtr as the function-name. If there are multiple parameters, it breaks and thinks each paraneter is a global variable.

Is there a way to tell Doxygen that these hints belong to the type and that GenericPtr(T) is actually a type, not a function declarator?

  • Doxygen can expand C preprocessor, search its options. – KamilCuk Jul 04 '21 at 17:39
  • But in the documentation I do not want expanded macros. The generated documentation should have as the return type `notnull GenericPtr(T)`, as the function-name `myMalloc` and as a parameter `s` of type `issizeof(T) size_t`. If the hints are not paremterized, this works like I want it to – Formal_Coder Jul 04 '21 at 17:50

0 Answers0