Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using lint comments with doxygen

For documentation, we usually have to create an additional document describing what we did when any lint messages were disabled in code (e.g. /* lint --e228). It would make it much easier to use it with doxygen (as we create this anyhow).

Though, I wasn't able to find any solution on how to make doxygen using these lint comments. Did anyone try this? Is there any solution how to use the stric '/*lint' but anyhow add it to doxygen?

Thanks!

like image 641
user1987872 Avatar asked Jan 17 '13 16:01

user1987872


People also ask

How do I add comments in doxygen?

To add a new Doxygen comment for a function simply generate it. Type /** , /*! , /// or //! and then press Enter . A stub will be generated for you in case your function has parameters, returns a value or throws an exception.

How do you write a doxygen comment?

Doxygen will extract comments starting with "--!". There are only two types of comment blocks in VHDL; a one line "--!" comment representing a brief description, and a multi-line "--!" comment (where the "--!" prefix is repeated for each line) representing a detailed description.

How do I comment out a code in doxygen C++?

Once specified, you can generate the comment stub by typing the respective “///” or “/**” above a function, or by using the (Ctrl+/) shortcut.

What is @brief in doxygen?

Putting the command @brief will generate a short description of the function when you generate the doxygen documentation. That short description can be extended if you want.


1 Answers

This can be accomplished by defining a macro to expand into the lint expression comment, but making the macro expand into a different comment when expanded by doxygen.

The trick is to use the -save instruction to PC-lintTM or FlexeLintTM:

#ifndef LINT_CONTROL
#define LINT_CONTROL(X) /*lint -save X */ //lint X
#endif

int main () {
    int a; LINT_CONTROL(-e530)
    return a != a;
}

Then, in your doxygen configuration file, you can enable expansion of certain preprocessor macros. In particular, we can change LINT_CONTROL to expand into a doxygen-ated comment instead.

ENABLE_PREPROCESSING   = YES
MACRO_EXPANSION        = YES
EXPAND_ONLY_PREDEF     = YES
PREDEFINED             = "LINT_CONTROL(X)=//! lint control: X"

Alternatively, if you have FlexeLintTM, then you can modify the shrouded source so that a doxygen comment can be used to trigger the lint control. The technique is described on the Gimpel Software Discussion Forum. (This link seems dead, and the new discussion forum seems to no longer contain the referenced discussion any longer.)

PC-lint and FlexeLint are trademarks of Gimpel Software.

like image 192
jxh Avatar answered Oct 05 '22 04:10

jxh