简体   繁体   English

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

[英]Configure Doxygen to ignore the Source-Code Annotation Language (SAL)

I have some classes that are documented with Doxygen. 我有一些用Doxygen记录的类。 Additionally, they are annotated with Microsoft's Source-Code Annotation Language (SAL) to support static code analysis. 此外,它们还使用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;
};

In this case, Doxygen reports a warning: 在这种情况下,Doxygen将报告警告:

argument 'pResult' of command @param is not found in the argument list of Foo::_Success_(return==Success)=0 在Foo :: _ Success_(return == Success)= 0的参数列表中找不到命令@param的参数'pResult'

So, Doxygen is confused by the annotation statement _Success_() . 因此,Doxygen被注释语句_Success_()弄糊涂了。 How can I hide the return value annotation _Success_(return == Success) to Doxygen without adding clutter to the source file? 如何在不向源文件添加混乱的情况下将返回值注释_Success_(return == Success)隐藏到Doxygen? This does the job, but looks too verbose: 这可以完成工作,但是看起来太冗长:

//! 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;
};

Can this be implemented by configuring Doxygen and leaving the source code untouched? 是否可以通过配置Doxygen并保持源代码不变来实现?

In the doxygen manual in the chapter Preprocessing there is a part: 在doxygen手册的“ Preprocessing ”一章中,有一部分内容:

A typically example where some help from the preprocessor is needed is when dealing with the language extension from Microsoft: __declspec . 一个典型的需要预处理器帮助的示例是在处理Microsoft的语言扩展时: __declspec The same goes for GNU's __attribute__ extension. GNU的__attribute__扩展也是如此。 Here is an example function. 这是一个示例函数。

In your case the following would probably work: 在您的情况下,以下方法可能会起作用:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Doxygen中使用Microsoft的源代码注释语言(SAL)? - Using Microsoft's Source-Code Annotation Language (SAL) with Doxygen? Microsoft 是否从 MSDN 中的 function 定义中删除了源代码注释语言 (SAL) 和调用约定 - Did Microsoft drop source-code annotation language (SAL) and calling convention from their function definition in MSDN SAL(源注释语言)的目的是什么,SAL 1和2之间有什么区别? - What is the purpose of SAL (Source Annotation Language) and what is the difference between SAL 1 and 2? Microsoft 源代码注释语言 (SAL) 不给出 C26100 或其他警告 - Microsoft source code annotation language (SAL) does not give C26100 or other warnings 微软的源注释语言(SAL) - 任何利用它的方法? - Microsoft's Source Annotation Language (SAL) — any way to take advantage of it? base :: Thread的源代码在哪里 - Where's the source-code for base::Thread 奇怪的 SAL 注释警告 - Strange SAL annotation warning “ __callback” SAL注释的作用是什么? - What is effect of “__callback” SAL annotation? 使用Doxygen和非Doxygen注释源代码创建文档 - Create Documentation using Doxygen and non-Doxygen commented source code 使用Doxygen从源文件生成代码 - Generating Code from a Source File Using Doxygen
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM