0

I am trying to generate the documentation for a C project. The problem that I am facing is that the call graph is not generated for a function implemented between conditional macro, though if I remove the macro, the graph gets generated.

#if (defined (X) && (TRUE == X))
void TestFunction()
{
  TestedFunction();
}
#endif

The tested function is defined in a header file inside the same conditional macro.

The following tags are set for doxygen:

ENABLE_PREPROCESSING   = YES
ENABLE_PREPROCESSING   = YES
SEARCH_INCLUDES        = YES
MACRO_EXPANSION        = YES
EXPAND_ONLY_PREDEF     = YES
EXTRACT_ALL            = NO
HAVE_DOT               = YES
CALL_GRAPH             = YES
CALLER_GRAPH           = YES
DOT_PATH               = $(GRAPHVIZ_DOT)
PREDEFINED             =  X=TRUE
OPTIMIZE_OUTPUT_FOR_C  = YES

There are more functions that I test and the call graph gets correctly generated.

I also checked the output of the preprocessor and whether without or with the conditional macro, the output is the same, the parser receives the test function. I even wrote the TestFunction between #if 1 ... #endif and still no graph is generated.

Preprocessor output:

void TestFunction()
{
  TestedFunction();
}

What I cant understand is how the call graph is generated when there is no #if ... and is not generated when the macro is present, considering that the input for the parser is the same, based on the Preprocessor file.

  • Which version of doxygen are you using? – albert Nov 22 '21 at 11:03
  • Sorry, I should have specified : 1.8.14.1 – Darius Crisan Nov 22 '21 at 11:08
  • Version 1.8.14 is a bit older ((December 25,2017), so an update to the current version (1.9.2) would be nice. I assume that the function `TestedFunction` has been defined as well (and is commented). I tried with adding an empty `TestedFunction` and setting `EXTRACT_ALL=YES` (didn't want top comment everything) and I do see the call / caller graphs. – albert Nov 22 '21 at 11:13
  • Indeed, `TestedFunction` is defined as well and commented like all other functions. Even when using `EXTRACT_ALL=YES` the call/caller graphs are still not created. I will try using a newer version. Thanks! – Darius Crisan Nov 22 '21 at 12:11
  • I've had some issues with doxygen callgraphs and macros before, and one issue was with files missing trailing newlines. I am not sure if it improve anything for you, but you might want to check that all your source and header files end with newline characters. – user694733 Nov 22 '21 at 12:30
  • I have asked one question about this earlier which may or may not be helpful for you: https://stackoverflow.com/q/28499422/694733 – user694733 Nov 22 '21 at 12:36
  • Thanks for your suggestion. My files do end with a new line. I also tried switching `ENABLE_PREPROCESSING` to `NO` but doesn't work for me. – Darius Crisan Nov 22 '21 at 13:00

0 Answers0