I have 3 files:
test.c
int table[] = {
#define X(val) val,
#include "test.x"
#undef X
};
void level2(void) {
level3();
level4();
}
void level3(void) {
level4();
}
test2.c
void level1(void) {
level2();
level3();
level4();
}
void level4(void) {
}
test.x
X(1)
X(2)
X(3)
I use doxygen to create callgraphs for these functions. Here's what I expected:
But here is what I got:
It seems X-macro on test.c is the culprit. I managed to make it work by doing 2 things (either will do):
test.x
so doxygen doesn't find it. It will show warning, but
callgraph is correct.test.x
. Normally file would end
immediately after X(3)
.Question:
How can I get reliable callgraph out of doxygen without editing the files? Is there a setting I need to change or is this plain bug?
I've had varying experience with xmacros. In general Doxygen will treat macros as proper declarations and not actually preprocess them. In order to get macros working (and this includes x-macros). In general:
MACRO_EXPANSION=yes
EXPAND_ONLY_PREDEF=yes
(which will make Doxygen expand all macros) orEXPAND_AS_DEFINED
.Additionally, take note of this: http://www.doxygen.nl/manual/config.html#cfg_skip_function_macros
To give you an idea about what's possible with xmacros and Doxygen, I can generate proper documentation from this: https://github.com/couchbase/libcouchbase/blob/master/include/libcouchbase/error.h#L95