After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 629182 - C/C++ preprocessor directives (#define, #ifdef, etc.) not handled correctly
C/C++ preprocessor directives (#define, #ifdef, etc.) not handled correctly
Status: RESOLVED FIXED
Product: doxygen
Classification: Other
Component: general
1.7.1
Other Linux
: Normal normal
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
Depends on:
Blocks:
 
 
Reported: 2010-09-09 15:04 UTC by Mike Kremer
Modified: 2010-10-09 08:19 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mike Kremer 2010-09-09 15:04:14 UTC
Hi there!

I guess I've found something that pretty much looks like a bug to me. Or maybe you can tell me whatever I did wrong. The error occurs when I try to parse a C++-header file containing some #define and #ifdef preprocessor directives.

This is a very basic setting which already causes the error to occur:

================================================
VectorTest.hh:

// TEST is not defined -> no output:
#ifdef TEST
 // Output 1
#endif

// Define TEST
#define TEST

// TEST is now defined but there will still be no output
#ifdef TEST
  // Output 2
#endif

// Define it once again
#define TEST

// Now it will work:
#ifdef TEST
  // Output 3
#endif
================================================

I made sure that ENABLE_PREPROCESSING as well as MACRO_EXPANSION (which should not have any influence here) are set to YES. If I run doxygen with -d Preprocessor, it will dump the following output when parsing the file specified above:

================================================
00001 
00002 // TEST is not defined -> no output:
00003 
00004 
00005 
00006 
00007 
00008 // Define TEST
00009 
00010 
00011 
00012 // TEST is now defined but there will still be no output
00013 
00014 
00015 
00016 
00017 // Define it once again
00018 
00019 #define TEST
00020 
00021 // Now it will work:
00022 
00023   // Output 3
00024 
00025 
================================================

It looks like the #ifdef in line 3 already affects the preprocessor in a way that two #defines will be necessary to correctly define TEST. If I remove the #ifdef branch that encapsulates "// Output 1" it works as expected.

I'm using doxygen 1.7.1. (source package).

I appreciate your help.

Regards,

Mike
Comment 1 Dimitri van Heesch 2010-10-02 19:24:01 UTC
This has to do with doxygen's include guard detection logic. Doxygen tries to omit include guards, but here it wrongly detected TEST as one.

Should be corrected in the next release.
Comment 2 Dimitri van Heesch 2010-10-09 08:19:19 UTC
This bug was previously marked ASSIGNED, which means it should be fixed in
doxygen version 1.7.2. Please verify if this is indeed the case. Reopen the
bug if you think it is not fixed and please include any additional information
that you think can be relevant.