【发布时间】:2022-01-01 19:26:11
【问题描述】:
假设下面的代码
#include <stdio.h>
#include <stddef.h>
#include <stdint.h>
/* en/disable second arg by un/commenting */
#define B_ARG_ENABLED
/**
* \fn add_stuff
* \brief add stuff to stuff
* \param a : bla bla
//////#ifdef B_ARG_ENABLED (obviously not working)
* \param b : blb blb
//////#endif //B_ARG_ENABLED
* \param c : blc blc
* \return : some stuff
*/
int add_stuff(int a,
#ifdef B_ARG_ENABLED
int b,
#endif //B_ARG_ENABLED
int c)
{
int total = 0;
total += a;
#ifdef B_ARG_ENABLED
total += b;
#endif //B_ARG_ENABLED
total += c;
return total;
}
int main(void)
{
printf("hello %d",add_stuff(
1,
#ifdef B_ARG_ENABLED
2,
#endif //B_ARG_ENABLED
3));
return 0;
}
我想要一个函数的唯一 doxygen 标头,但该函数的参数受预处理器变量的制约。
有没有办法保留唯一的 doxygen 标头?
即:不使用两个包装器 add_stuff2 和 add_stuff3
【问题讨论】:
-
哪个 doxygen 版本?我认为
/* \fn add_stuff行至少应该读为/** \fn add_stuff,因为现在doxygen 并没有真正看到该评论。 -
所有版本。如果某个版本有什么可能,我很乐意知道。
-
您尝试过的最新版本是什么(虽然不起作用),请参阅即将发布的答案。 doxygen 的当前版本是 1.9.2
标签: c doxygen preprocessor