1

I'm trying to document a function guarded by a #define. The define is off by default.

#ifdef ___FOO_BAR___
  void FooBar(void);
#endif

The file is being processed by Doxygen. I have added the \Fn command according to Doxygen's Documenting the code and the section Documentation at other places:

#ifdef ___FOO_BAR___
  //! \Fn void FooBar()
  //! \brief ...
  //! \details ...
  DECLSPEC void API FooBar();
#endif

However, the function FooBar is not being documented. Using \fn makes no difference. And moving the documentation outside the macro's block makes no difference.

How do I instruct Doxygen to produce documentation for the function, even though its guarded by a define (and the define if off)?


The above is part of an #if \ #else \ #endif, so I can't use preprocessor tricks. I want both sets of functions documented. In the \details, we explain the function is only available when a particular define is enabled.


$ doxygen -version
1.8.9.1
jww
  • 97,681
  • 90
  • 411
  • 885
  • This S.O. link might help. http://stackoverflow.com/questions/2356120/documenting-preprocessor-defines-in-doxygen – KeithSmith Nov 02 '15 at 22:55
  • This one too: http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier – juanchopanza Nov 02 '15 at 22:58
  • @KeithSmith - my bad... I'm trying to document the function, not the define. – jww Nov 02 '15 at 23:08
  • @jww It isn't directly relevant to the question you're asking , but `___FOO_BAR___` is a reserved name. In this case it is unlikely to cause a problem, but it is good to make a habit of not using them. – juanchopanza Nov 03 '15 at 06:49
  • @juanchopanza - OK, thanks. I used three underscores to avoid that problem (some past questions got bogged down on the number of underscores a symbol in a library should have). – jww Nov 03 '15 at 06:54

1 Answers1

2

Try to use the PREDEFINED tag to control the behavior to you liking. You can check here for more information.

I order to see what is expanded from the doxygen included pre processor try

doxygen -d Preprocessor
albert
  • 8,285
  • 3
  • 19
  • 32
g24l
  • 3,055
  • 15
  • 28