小编Squ*_*rel的帖子

用于C Tempate仿真的氧气

我正在尝试使用Doxygen为C中的模拟模板生成文档而没有太大成功.我希望有人知道如何在doxygen预处理器中使宏技巧工作?我已经尝试过启用"MACRO_EXPANSION"而没有运气.

编辑:这个问题最变性的形式是:"我怎样才能使Doxygen以与C预处理器类似的方式处理预处理器指令#include?"

我在"test"文件夹中有以下代码(一个非常人为的例子):

templates.h

#ifndef TEMPLATES_H_
#define TEMPLATES_H_

#define CAT(X,Y) X##_##Y
#define TEMPLATE(X,Y) CAT(X,Y)

#endif // TEMPLATES_H_
Run Code Online (Sandbox Code Playgroud)

test.h

#ifndef TEST_H_
#define TEST_H_

#include "templates.h"

#ifdef TEST_T
#error "TEST_T cannot be defined prior to this compilation step"
#endif

#define TEST_T uint8_t
#include "test_template.h"
#undef TEST_T

#define TEST_T uint16_t
#include "test_template.h"
#undef TEST_T

#endif // TEST_H_
Run Code Online (Sandbox Code Playgroud)

test_template.h

#ifdef TEST_T

#include "templates.h"

TEST_T TEMPLATE(sum,TEST_T)(TEST_T a, TEST_T b);

#endif // ifdef TEST_T
Run Code Online (Sandbox Code Playgroud)

test.c的

#include "test.h"

#ifdef TEST_T
#error "TEST_T cannot be defined prior to …
Run Code Online (Sandbox Code Playgroud)

c macros templates doxygen c-preprocessor

5
推荐指数
1
解决办法
494
查看次数

标签 统计

c ×1

c-preprocessor ×1

doxygen ×1

macros ×1

templates ×1