user1987872
user1987872

Reputation: 101

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!

Upvotes: 10

Views: 958

Answers (1)

jxh
jxh

Reputation: 70402

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.

Upvotes: 2

Related Questions