gpt4 book ai didi

c++ - 配置 Doxygen 以忽略源代码注释语言 (SAL)

转载 作者:行者123 更新时间:2023-11-30 03:21:53 25 4
gpt4 key购买 nike

我有一些用 Doxygen 记录的类。此外,它们使用 Microsoft 的源代码注释语言 (SAL) 进行注释以支持静态代码分析。

//! The majestic class.
class Foo {
//! \brief do something
//! \param [out] pResult The result value is stored here.
//! \returns The return value Succcess indicates success.
_Success_(return == Success)
virtual Result_t DoSomething(_Out_ uint32_t *pResult) = 0;
};

在这种情况下,Doxygen 会报告一个警告:

argument 'pResult' of command @param is not found in the argument list of Foo::_Success_(return==Success)=0

所以,Doxygen 被注解语句_Success_() 搞糊涂了。如何隐藏返回值注释_成功_(返回==成功)去氧不给源文件添加困惑?这样可以完成工作,但看起来太冗长了:

//! The majestic class.
class Foo {
//! \brief do something
//! \param [out] pResult The result value is stored here.
//! \returns The return value Succcess indicates success.
//! \cond INTERNAL
_Success_(return == Success)
//! \endcond
virtual Result_t DoSomething(_Out_ uint32_t *pResult) = 0;
};

这可以通过配置 Doxygen 并保持源代码不变来实现吗?

最佳答案

Preprocessing一章的doxygen手册中有一部分:

A typically example where some help from the preprocessor is needed is when dealing with the language extension from Microsoft: __declspec. The same goes for GNU's __attribute__ extension. Here is an example function.

在您的情况下,以下可能会起作用:

ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
PREDEFINED = _Success_(x)=

关于c++ - 配置 Doxygen 以忽略源代码注释语言 (SAL),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51741626/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com