1

I'm using Doxygen version 1.8.11 and trying to doc my X macro:

#define COLOR_VARIABLES\
COLOR__X(RED /*!< "RED COLOR" */)\
COLOR__X(BLUE /*!< "BLUE COLOR" */)\

Then I use it in an enum:

/** COLOR doc */
typedef enum {
  #define COLOR__X(name) name,
     COLOR_VARIABLES
  #undef COLOR__X

} color;

I have the MACRO_EXPANSION and ENABLE_PREPROCESSING set to YES and the @file at the beginning of my file.

I'd like the HTML created with the doxygen to show the documentation for each variable defined with the x macro. Can it be done?

Edit:

So after some suggestions here, I noticed that in my doxyfile I have the following configurations:

MACRO_EXPANSION        = YES
EXPAND_ONLY_PREDEF     = YES
ENABLE_PREPROCESSING   = YES
PREDEFINED             = INNER_FUNC(msg)=

If I change the EXPAND_ONLY_PREDEF to No it will work but it causes other problems in my project. I have tried to do the following options but it didn't work:

Option 1:

PREDEFINED             = INNER_FUNC(msg)= /
                        COLOR__X(name)=name, /
                        COLOR__X:=COLOR__X

Option 2:

EXPAND_AS_DEFINED      = COLOR__X(name) /
                        COLOR__X
Gald
  • 11
  • 2
  • deos this help https://stackoverflow.com/questions/28499422/x-macro-breaks-doxygen-callgraph ? – tstanisl Sep 13 '21 at 12:49
  • 1
    Your question describes what you want to do, but not why it fails. Please provide information on how your approach fails to do what you intend. – user694733 Sep 13 '21 at 13:01
  • Does this answer your question? [X-macro breaks doxygen callgraph](https://stackoverflow.com/questions/28499422/x-macro-breaks-doxygen-callgraph) – Adrian Mole Sep 19 '21 at 14:37
  • You mention: If I change the `EXPAND_ONLY_PREDEF` to `No` it will work but it causes other problems in my project. What kind of problems? – albert Sep 20 '21 at 09:30
  • I did what you said and changed `EXPAND_ONLY_PREDEF` to `No` and fixed the other problem I had which required to add the following to the doxyfile: `PREDEFINED = __attribute__((x))= ` Thanks for the help! – Gald Sep 20 '21 at 10:45

1 Answers1

2

A bit to long for a comment. I don't see a problem (with 1.8.11 and 1.9.2).

The doxygen version 1.8.11 is from December 2015, so I would really advise you to upgrade to the current version (1.9.2)

I used: aa.h

/// \file

#define COLOR_VARIABLES\
COLOR__X(RED /*!< "RED COLOR" */)\
COLOR__X(BLUE /*!< "BLUE COLOR" */)\

/** COLOR doc */
typedef enum {
  #define COLOR__X(name) name,
     COLOR_VARIABLES
  #undef COLOR__X

} color;

Doxyfile

MACRO_EXPANSION = YES
ENABLE_PREPROCESSING = YES
QUIET = YES

and got as result:

enter image description here

This looks OK to me. Did I miss something?

albert
  • 8,285
  • 3
  • 19
  • 32
  • When I tried to do that, the html doesn't show the enumerators, just the enum description "COLOR doc". Also I want to link to it from another function documentation and I get the error: `error: explicit link request to 'RED' could not be resolved (warning treated as error, aborting now) – Gald Sep 13 '21 at 14:56
  • Please show the minimal code you used (with file names) and the settings you used diffeerent from the default settings. Hard to tell what you exactly did. – albert Sep 13 '21 at 16:25