Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C/C++ preprocessor directives (#define, #ifdef, etc.) not handled correctly (Origin: bugzilla #629182) #3931

Closed
doxygen opened this Issue Jul 2, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@doxygen
Copy link
Owner

doxygen commented Jul 2, 2018

status RESOLVED severity normal in component general for ---
Reported in version 1.7.1 on platform Other
Assigned to: Dimitri van Heesch

On 2010-09-09 15:04:14 +0000, Mike Kremer wrote:

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

On 2010-10-02 19:24:01 +0000, Dimitri van Heesch wrote:

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.

On 2010-10-09 08:19:19 +0000, Dimitri van Heesch wrote:

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.

@doxygen doxygen closed this Jul 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.