Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I keep doxygen from documenting #defines in a C file?

I have #define values in headers that I certainly want Doxygen to document but I have others in C files that I treat as static constants and I don't want Doxygen to document them. Something as simple and stupid as

#define NUMBER_OF(a) (sizeof((a))/sizeof((a)[0]))
#define MSTR(e) #e

How can I keep Doxygen from putting those #defines in the documentation it creates? I've tried marking it with @internal but that didn't seem to help.

A somewhat-related question on Doxygen and #define, how can I get:

#define SOME_CONSTANT 1234 /**< An explanation */

to put "SOME_CONSTANT" and "An explanation" but not "1234" in the output?

like image 944
Chris Nelson Avatar asked Nov 04 '09 16:11

Chris Nelson


People also ask

How exclude code from Doxygen?

How can I make doxygen ignore some code fragment? The new and easiest way is to add one comment block with a \cond command at the start and one comment block with a \endcond command at the end of the piece of code that should be ignored.

Should Doxygen be in header or source?

In general, these Doxygen style function comment blocks should only be placed in the class header file, not the source file, in order to avoid confusion as to which one doxygen will use when generating the documentation.

How long does Doxygen take?

Doxygen takes about 12 hours to run on our code base. This is primarily because there is a lot of code to process (~1.5M lines).


2 Answers

There is no need to use the \cond and \endcond commands. You can hide the initializer by simply using the \hideinitializer command:

#define SOME_CONSTANT 1234 /**< An explanation @hideinitializer */

Regarding the first question, you may set HIDE_UNDOC_MEMBERS = YES and only the macros having a Doxygen documentation block will be shown in the output.

like image 121
bszente Avatar answered Nov 06 '22 10:11

bszente


You can set MAX_INITIALIZER_LINES = 0 in your doxyfile to hide the values of your defines.

like image 31
emp Avatar answered Nov 06 '22 12:11

emp