I am trying to generate documentation using Doxygen for emulated templates in C without much success. I am hoping someone knows how to make the macro trickery work in the doxygen preprocessor? I have already tried enabling "MACRO_EXPANSION" without luck.
EDIT: The most denatured form of this question would be: "How can I make Doxygen handle the preprocessor directive #include in a similar way that the C preprocessor does?"
I have the following code in a folder "test" (a very contrived example):
templates.h
#ifndef TEMPLATES_H_
#define TEMPLATES_H_
#define CAT(X,Y) X##_##Y
#define TEMPLATE(X,Y) CAT(X,Y)
#endif // TEMPLATES_H_
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_
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
test.c
#include "test.h"
#ifdef TEST_T
#error "TEST_T cannot be defined prior to this compilation step"
#endif
#define TEST_T uint8_t
#include "test_template.c"
#undef TEST_T
#define TEST_T uint16_t
#include "test_template.c"
#undef TEST_T
test_template.c
#ifdef TEST_T
TEST_T TEMPLATE(sum,TEST_T)(TEST_T a, TEST_T b)
{
return a + b;
}
#endif // ifdef TEST_T
In my doxygen config file:
test.cfg
# Doxyfile 1.8.13
PROJECT_NAME = "Test"
OUTPUT_DIRECTORY = "docs_test"
TAB_SIZE = 3
OPTIMIZE_OUTPUT_FOR_C = YES
INPUT = "../test"
RECURSIVE = YES
MACRO_EXPANSION = YES
# Temporary to extract all without tags
EXTRACT_ALL = YES
However, the templated versions of the sum* function aren't present in doxygen (.h or .c documentation); for example, test.h is below (although I would also be happy if it showed up in test_template.h instead):
Any thoughts?