Doxygen文档所有条件定义 [英] Doxygen Document All Conditional Defines

查看:99
本文介绍了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 code>。

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文档所有条件定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆