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

Closed
opened this Issue Jul 2, 2018 · 0 comments

 status RESOLVED severity normal in component build for --- Reported in version 1.7.6.1 on platform Other Assigned to: Dimitri van Heesch Original attachment names and IDs: doxydefs.7z (ID 207796) 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 #endif 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, DefineManager::instance().addFileToContext(g_yyFileName); 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 @@ BEGIN(Start); g_yyLineNr++; } +"pragma"{B}+"once" {  g_expectGuard = FALSE;   }  {ID} { // unknown directive BEGIN(IgnoreLine); } 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.