It seems Doxygen (1.13.2) still has some issues handling C typedefed structs even if I use the TYPEDEF_HIDES_STRUCT = YES
option. (setting OPTIMIZE_OUTPUT_FOR_C
has no effect on this either)
- This one works perfectly
// in file A.h
typedef struct _A {
} A;
// in file B.h
#include "A.h"
typedef struct _B {
A super;
} B;
in the generated documentation
- both A and B treated as class definitions
- all the mentions of A and B are linked correctly to the A(_A) and B(_B)
- the generated graph in details of B(_B) shows the correct "inheritance" B->A
- This one fails
// in file A.h
// adding struct _A; here will not make any difference
typedef struct _A A;
struct _A {
int (*func)(A *s);
};
// in file B.h
#include "A.h"
typedef struct _B {
A super;
} B;
in which case
- both A and B treated as class definitions
- only mentions of B are linked correctly to B(_B)
- the generated graph in details of B(_B) does not show or mention A(_A) at all
As you can see in example 2, I sometimes have to use forward declarations; there is no other option.
The example config differences compared to the default are
# Difference with default Doxyfile 1.13.2
PROJECT_NAME = "example doc"
OUTPUT_DIRECTORY = build/doc
CREATE_SUBDIRS = YES
TYPEDEF_HIDES_STRUCT = YES
NUM_PROC_THREADS = 6
EXTRACT_ALL = YES
INPUT = ./
FILE_PATTERNS = *.c \
*.h
RECURSIVE = YES
EXCLUDE = build
EXCLUDE_PATTERNS = */build/*
USE_MDFILE_AS_MAINPAGE = README.md
GENERATE_LATEX = NO
HAVE_DOT = YES
Real life reproduction of the problem
git clone -b develop .git syslog-ng
mkdir build
doxygen
and
- open ./build/doc/index.html
- in the left the navigation bar open syslog-ng
source\Classes\Class List\AFSocketSourceDriver
(in the example A(_A) - looks nice and clean
- now open AFInetSourceDriver at
syslog-ng source\Classes\Class List\AFInetSourceDriver
(in the example B(_B) - try to click AFSocketSourceDriver anywhere, that should be a link to the AFSocketSourceDriver class (in the example A(_A), but it is not a link
- there is no reference at all to AFSocketSourceDriver` (in the example A(_A)
My questions are:
- How can I get Doxygen to behave the same in case 2 as it does in case 1?
- Are there any alternatives to Doxygen that can handle this?