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

#define in conditionally compiled block not documented (Origin: bugzilla #670235) #4569

doxygen opened this Issue Jul 2, 2018 · 0 comments


None yet
1 participant

doxygen commented Jul 2, 2018

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

Original attachment names and IDs:

On 2012-02-16 17:33:20 +0000, Martin Sauerhoff wrote:

Created attachment 207796
Doxygen input files to reproduce bug

The problem arises with constructs of the following type:

//! \def BLA
//! \brief Comment for BLA.

#ifndef BLA
#define BLA 0

Assume that this is contained in a file defs.h and another file otherfile.h
including this defs.h is evaluated by doxygen before defs.h itself is evaluated.
Then the define BLA is not documented. (See attached example.)

Reason: When defs.h is evaluated for the first time by doxygen as an #include
of otherfile.h, its defines are stored in a file -> definitions map. When
defs.h is evaluated again, the stored defines are copied to its initial
context. Hence, in the described situation, BLA is erroneously already
defined when the #define is parsed, and the #define is stripped away
by the preprocessor.

A solution may be to remove the instruction adding the the stored defines
for a parsed file itself,


in function preprocessFile (line 2779 of src/pre.l). I do not know what the
side-effects of this are, though, and why the instruction is there in the
first place.

On 2012-02-16 19:01:37 +0000, Dimitri van Heesch wrote:

*** Bug 670237 has been marked as a duplicate of this bug. ***

On 2012-03-10 13:46:10 +0000, Dimitri van Heesch wrote:

Hi Martin,

This is an include guard detection problem, like for bug # 670237.
I'll make doxygen parse the "#pragma once" and when found use that to stop looking for include guards.

If you want to try, here is the patch I have in mind:

--- ../../doxygen-svn/src/pre.l 2012-02-25 15:21:29.000000000 +0100
+++ pre.l 2012-03-10 14:34:45.000000000 +0100
@@ -2073,6 +2073,9 @@
+"pragma"{B}+"once" {

  •                                      g_expectGuard = FALSE;
  •                                    }

{ID} { // unknown directive

On 2012-03-15 09:24:38 +0000, Martin Sauerhoff wrote:

Hi Dimitri,

Thanks for the patch. I think this provides an acceptable workaround
for bug 670235 (it is not a 100 % solution since it only works if you
actually use "#pragma once", but I think this is okay). It will probably
do nothing to solve bug 670237, though.

On 2012-05-19 12:26:55 +0000, Dimitri van Heesch wrote:

This bug was previously marked ASSIGNED, which means it should be fixed in
doxygen version 1.8.1. 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