GNOME Bugzilla – Bug 612364
Macro Accessibility bug.
Last modified: 2010-06-15 11:22:29 UTC
Created attachment 155697 [details] macro accessibility test code In doxygen 1.6.3 on Windows XP (and probably other platforms), macro is not accessible correctly. Please take a look at attachment zip file. This consist of a.h, b.h, and c.h. ------------------- a.h -------------------------- #include "c.h" #ifdef C_IS_INCLUDED /// a_expected. class a_expected{}; #else /// a_not_expected. class a_not_expected{}; #endif ------------------- b.h -------------------------- #include "c.h" #ifdef C_IS_INCLUDED /// b_expected. class b_expected{}; #else /// b_not_expected. class b_not_expected{}; #endif ------------------- c.h -------------------------- #define C_IS_INCLUDED #ifndef CCC /// ccc. #define CCC( x ) x #endif -------------------------------------------------- I expected that doxygen generate document of a_expected, b_expected, and CCC. But a_expected, b_not_expected, and CCC were documented. On preprocessing, macroIsAccessible() in pre.l judged that C_IS_INCLUDED is not accessible from b.h. It is considered that C_IS_INCLUDED is defined in a.h. Following patch fixed this accessibility bug, but another problem occurred. Document of CCC was missing. This is perhaps because g_fileDefineDict is not cleared in preprocessFile(). But I'm not sure that it is safe to clear g_fileDefineDict. Index: pre.l =================================================================== --- pre.l (revision 724) +++ pre.l (working copy) @@ -281,8 +281,18 @@ { fs->oldFileBuf = g_inputBuf; fs->oldFileBufPos = g_inputBufPos; - fs->fileDef = g_yyFileDef; - fs->fileName = g_yyFileName; + bool ambig; + FileDef *fd = findFileDef(Doxygen::inputNameDict,absName,ambig); + if (fd) + { + fs->fileDef = fd; + fs->fileName = absName; + } + else + { + fs->fileDef = g_yyFileDef; + fs->fileName = g_yyFileName; + } } } return fs;
This patch seems to fix above all bugs in my environment. Index: pre.l =================================================================== --- pre.l (revision 724) +++ pre.l (working copy) @@ -281,8 +281,18 @@ { fs->oldFileBuf = g_inputBuf; fs->oldFileBufPos = g_inputBufPos; - fs->fileDef = g_yyFileDef; - fs->fileName = g_yyFileName; + bool ambig; + FileDef *fd = findFileDef(Doxygen::inputNameDict,absName,ambig); + if (fd) + { + fs->fileDef = fd; + fs->fileName = absName; + } + else + { + fs->fileDef = g_yyFileDef; + fs->fileName = g_yyFileName; + } } } return fs; @@ -2474,15 +2484,16 @@ g_outputBuf=&output; g_includeStack.setAutoDelete(TRUE); g_includeStack.clear(); - //g_fileDefineDict->setAutoDelete(TRUE); - //g_fileDefineDict->clear(); + g_fileDefineDict->setAutoDelete(TRUE); + g_fileDefineDict->clear(); g_expandedDict->setAutoDelete(FALSE); g_expandedDict->clear(); g_condStack.clear(); g_condStack.setAutoDelete(TRUE); - - static bool firstTime=TRUE; - if (firstTime) + g_allIncludes.clear(); + + //static bool firstTime=TRUE; + //if (firstTime) { // add predefined macros char *defStr; @@ -2592,7 +2603,7 @@ // def->name.data(),def->definition.data(),def->nargs); } } - firstTime=FALSE; + //firstTime=FALSE; } #if 0
Confirmed. I don't think clearing the g_fileDefineDict is the right solution, but I think I can find one that does work, and still does not require preprocessing the same files over and over again.
This bug was previously marked ASSIGNED, which means it should be fixed in doxygen version 1.7.0. 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.