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

Macro Accessibility bug. (Origin: bugzilla #612364) #3700

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 critical in component general for ---
Reported in version 1.6.3 on platform Other
Assigned to: Dimitri van Heesch

Original attachment names and IDs:

On 2010-03-10 00:36:21 +0000, Shunichi Ikegami wrote:

Created attachment 155697
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;

On 2010-03-10 02:00:34 +0000, Shunichi Ikegami wrote:

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

On 2010-03-13 22:40:14 +0000, Dimitri van Heesch wrote:

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.

On 2010-06-15 11:22:29 +0000, Dimitri van Heesch wrote:

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.

@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.