Doxygen文档所有条件定义

编程入门 行业动态 更新时间:2024-10-28 08:29:33
本文介绍了Doxygen文档所有条件定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个项目,其中有大量的条件定义可简化跨平台开发。但是,我在说服Doxygen提取所有定义时遇到了问题,因为它只会拾取那些仅用于评估的定义。

I have a project where I have a substantial amount of conditional defines for making cross platform development easier. However I'm having issues convincing Doxygen to extract all the defines, as it will only pick up ones that only happened to evaluate.

例如,在以下代码段中,Doxygen将记录 TARGET_X86_64 而不记录 TARGET_ARM64

For example in the following snippet, Doxygen will document TARGET_X86_64 but not TARGET_ARM64.

#if defined(_M_ARM64) || defined(__arm64__) || defined(__aarch64__) /** Build target is ARM64 if defined. */ #define TARGET_ARM64 #else /** Build target is x86_64 if defined. */ #define TARGET_X86_64 #endif

启用EXTRACT_ALL没有帮助,禁用预处理会使Doxygen根本不记录任何内容。如何获得双氧水提取两种情况的文件?

Enabling EXTRACT_ALL did not help, and disabling preprocessing causes Doxygen to not document anything at all. How do I get doxygen to extract documentation for both cases?

推荐答案

我提出了一个冗长但可行的解决方案。当您想要拥有 #elseif 语句时,与仅使用纯 #if 语句相比,它会比较别扭。

I made a "solution" that's verbose, but works. It's less awkward when you want to have #elseif statements than using just using pure #if statements. Although either would work.

首先,定义所有内容,而不关心条件逻辑。

First, define everything and not care about conditional logic.

/** Some define */ #define TARGET_DEFINE /** Some other define */ #define OTHER_TARGET_DEFINE

第二,采用您最初使用的条件逻辑创建定义并将其转换为未定义逻辑。

Second, take the conditional logic that you originally used to create the defines and transform it to undefine logic.

#if !(ORIGINAL_LOGIC) #undef TARGET_DEFINE #endif

最后,更改条件逻辑,以便在doxygen进行预处理时未定义任何内容。

Lastly, change the conditional logic so that nothing is undefined when doxygen is doing the preprocessing.

#if !defined(DOXYGEN) ...

更多推荐

Doxygen文档所有条件定义

本文发布于:2023-07-15 10:09:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1110593.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:定义   条件   文档   Doxygen

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!