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 612364 - Macro Accessibility bug.
Macro Accessibility bug.
Status: RESOLVED FIXED
Product: doxygen
Classification: Other
Component: general
1.6.3
Other Windows
: Normal critical
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
Depends on:
Blocks:
 
 
Reported: 2010-03-10 00:36 UTC by Shunichi Ikegami
Modified: 2010-06-15 11:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
macro accessibility test code (47.37 KB, application/zip)
2010-03-10 00:36 UTC, Shunichi Ikegami
Details

Description Shunichi Ikegami 2010-03-10 00:36:21 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;
Comment 1 Shunichi Ikegami 2010-03-10 02:00:34 UTC
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
Comment 2 Dimitri van Heesch 2010-03-13 22:40:14 UTC
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.
Comment 3 Dimitri van Heesch 2010-06-15 11:22:29 UTC
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.