简体   繁体   中英

doxygen preprocessing C file

I have the following C code, I want to preprocess with doxygen and generate a call graph (I set ENABLE_PREPROCESSING = TRUE):

#define CALL_ENABLE 1
#define REPORT_ERROR_TEST 0

#if (CALL_ENABLE == 1)
void FuncLogError()
{
   #if (REPORT_ERROR_TEST == 1)
   FuncReportStatus();
   #endif
}
#endif

In the call graph I obtain FuncLogError calls FuncReportStatus , despite the const REPORT_ERROR_TEST is equal 0.It seems like preprocessing is ignored for condition #if (REPORT_ERROR_TEST == 1) .

Did you tell doxygen about the macro values? If not, use

PREDEFINED=CALL_ENABLE=1
PREDEFINED+=REPORT_ERROR_TEST=0
MACRO_EXPANSION=YES

in the doxygen configuration file.

Depending on your needs, you could disable the pre-processing done by doxygen:

# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
# C-preprocessor directives found in the sources and include files.
# The default value is: YES.

ENABLE_PREPROCESSING   = YES

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM