Home:ALL Converter>Doxygen can't expand AUTOSAR macros

Doxygen can't expand AUTOSAR macros

Ask Time:2020-08-31T14:42:02         Author:Isyola

Json Formatter

I am using Doxygen v1.8.9.1 to analyze an AUTOSAR C code. AUTOSAR code has some macros to define variables and functions. Something like this:

#define P2VAR(ptrtype, memclass, ptrclass)  ptrtype *

I tried to change the following configurations:

ENABLE_PREPROCESSING
MACRO_EXPANSION     
EXPAND_ONLY_PREDEF  
EXPAND_AS_DEFINED   
SKIP_FUNCTION_MACROS

and no matter what I do, it doesn't recognize the functions and variables defined using these macros. Rather, it sees multiple functions with the same name.

for example: if I have the following code:

typedef P2VAR( uint8, AUTOMATIC, DATA_LOCATION)  var_1;
typedef P2VAR( uint8, AUTOMATIC, DATA_LOCATION)  var_2;
typedef P2VAR( uint8, AUTOMATIC, DATA_LOCATION)  var_3;

It will not see 3 variables of type uint8 names var_1, var_2, var_3 but it sees 3 functions with the same name P2VAR

example from the xml output:

enter image description here

anyone have seen this before and was able to fix it?

Author:Isyola,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/63665978/doxygen-cant-expand-autosar-macros
albert :

In case I use your code:\n\n#define P2VAR(ptrtype, memclass, ptrclass) ptrtype *\n\n\ntypedef P2VAR( uint8, AUTOMATIC, DATA_LOCATION) var_1;\ntypedef P2VAR( uint8, AUTOMATIC, DATA_LOCATION) var_2;\ntypedef P2VAR( uint8, AUTOMATIC, DATA_LOCATION) var_3;\n\nand as doxygen configuration file:\nQUIET=YES\nEXTRACT_ALL=YES\nENABLE_PREPROCESSING=YES\nMACRO_EXPANSION =YES\nEXPAND_AS_DEFINED=YES\nGENERATE_XML=YES\n\nI see P2VAR only once in the definitions part and once in the index (and of course in the code part).\nI see this in case of doxygen version 1.8.20 as well as with version 1.8.9.1",
2020-08-31T08:13:30
yy