1

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)

  1. 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

links of A are correct, graph is fine class names are fine

  1. 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

no links, missing graph incorrect class name _A

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 https://github.com/syslog-ng/syslog-ng.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:

  1. How can I get Doxygen to behave the same in case 2 as it does in case 1?
  2. Are there any alternatives to Doxygen that can handle this?
7
  • Which version of doxygen are you using? What is in your settings file (different from the default settings, so the result of doxygen -x Doxyfile) Commented Mar 2 at 10:41
  • Why is there no ; at the end of : A* super? Commented Mar 2 at 10:46
  • Please edit the settings into the issue. Does the problem when having the ; still occur? Commented Mar 2 at 10:55
  • after correcting all the copy-paste issues in the examples, it is now perfectly represents and reproduces the real-life issue Commented Mar 2 at 13:41
  • 1
    I'll look into it when I finished my current edit session / work (hopefully at the end of the day ...) Commented Mar 3 at 10:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.