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 560512 - C++ code using templates ending with >> does not get parsed properly (but hey it's not really valid C++ so why should it)
C++ code using templates ending with >> does not get parsed properly (but hey...
Status: RESOLVED FIXED
Product: doxygen
Classification: Other
Component: build
1.5.7.1
Other All
: Normal normal
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
: 527202 577464 587629 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-11-12 14:54 UTC by Jonas Truemper
Modified: 2009-08-20 10:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
testclass header file (128 bytes, text/plain)
2008-11-12 14:59 UTC, Jonas Truemper
Details
testclass implementation file (66 bytes, text/plain)
2008-11-12 15:02 UTC, Jonas Truemper
Details
doxygen config file (59.35 KB, application/octet-stream)
2008-11-12 15:02 UTC, Jonas Truemper
Details

Description Jonas Truemper 2008-11-12 14:54:15 UTC
Please describe the problem:
Doxygen does not parse source code below a Typedef that uses at least two template classes inside the declaration and if the closing braces (">") do not have whitespaces between them. If this is before a class definition, the class will simply not be parsed/present in the output afterwards.

Here is some sample code that if run doxygen on, reproduces the faulty behavior:

######## The header file:

typedef std::pair<std::string, std::vector<unsigned int>> SomeTypeDefWithTwoTemplates;

class TestClass {
  void foo();
};


######## The implementation:
#include "testclass.h"

void TestClass::foo() {
  int x = 0;
}


So pay special attention to the typedef:
typedef std::pair<std::string, std::vector<unsigned int>> SomeTypeDefWithTwoTemplates;

would cause doxygen to miss the class definition below.

If you put the typedef as follows, everything works fine:

typedef std::pair<std::string, std::vector<unsigned int> > SomeTypeDefWithTwoTemplates;

(See the difference at the template closing brackets, the WHITESPACE)



This is a kind of problematic bug since a lot of header files can contain some typedefs in front of a class definition!

Steps to reproduce:
1. Save the source code provided in the description to .h and .cpp files
2. Save the doxygen configuration provided under "other information"
3. Run doxygen with the provided config file.



Actual results:
Check XML output for correctness. There should be no class file if there is no space between the closing template braces.

Expected results:
There should be an XML file describing the structure of the class TestClass

Does this happen every time?
yes

Other information:
Doxygen config file to reproduce the bug:


# Doxyfile 1.5.4

#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING      = UTF-8
PROJECT_NAME           = 
PROJECT_NUMBER         = 
OUTPUT_DIRECTORY       = 
CREATE_SUBDIRS         = NO
OUTPUT_LANGUAGE        = English
BRIEF_MEMBER_DESC      = YES
REPEAT_BRIEF           = YES
ABBREVIATE_BRIEF       = 
ALWAYS_DETAILED_SEC    = NO
INLINE_INHERITED_MEMB  = NO
FULL_PATH_NAMES        = YES
STRIP_FROM_PATH        = 
STRIP_FROM_INC_PATH    = 
SHORT_NAMES            = NO
JAVADOC_AUTOBRIEF      = NO
QT_AUTOBRIEF           = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP         = NO
INHERIT_DOCS           = YES
SEPARATE_MEMBER_PAGES  = NO
TAB_SIZE               = 8
ALIASES                = 
OPTIMIZE_OUTPUT_FOR_C  = NO
OPTIMIZE_OUTPUT_JAVA   = NO
BUILTIN_STL_SUPPORT    = NO
CPP_CLI_SUPPORT        = NO
SIP_SUPPORT            = NO
DISTRIBUTE_GROUP_DOC   = NO
SUBGROUPING            = YES
TYPEDEF_HIDES_STRUCT   = NO
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL            = YES
EXTRACT_PRIVATE        = YES
EXTRACT_STATIC         = YES
EXTRACT_LOCAL_CLASSES  = YES
EXTRACT_LOCAL_METHODS  = YES
EXTRACT_ANON_NSPACES   = YES
HIDE_UNDOC_MEMBERS     = NO
HIDE_UNDOC_CLASSES     = NO
HIDE_FRIEND_COMPOUNDS  = NO
HIDE_IN_BODY_DOCS      = NO
INTERNAL_DOCS          = NO
CASE_SENSE_NAMES       = NO
HIDE_SCOPE_NAMES       = NO
SHOW_INCLUDE_FILES     = YES
INLINE_INFO            = YES
SORT_MEMBER_DOCS       = YES
SORT_BRIEF_DOCS        = NO
SORT_BY_SCOPE_NAME     = NO
GENERATE_TODOLIST      = YES
GENERATE_TESTLIST      = YES
GENERATE_BUGLIST       = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS       = 
MAX_INITIALIZER_LINES  = 30
SHOW_USED_FILES        = YES
SHOW_DIRECTORIES       = NO
FILE_VERSION_FILTER    = 
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET                  = NO
WARNINGS               = NO
WARN_IF_UNDOCUMENTED   = NO
WARN_IF_DOC_ERROR      = NO
WARN_NO_PARAMDOC       = NO
WARN_FORMAT            = "$file:$line: $text "
WARN_LOGFILE           = 
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT                  = 
INPUT_ENCODING         = UTF-8
FILE_PATTERNS          = 
RECURSIVE              = YES
EXCLUDE                = 
EXCLUDE_SYMLINKS       = NO
EXCLUDE_PATTERNS       = 
EXCLUDE_SYMBOLS        = 
EXAMPLE_PATH           = 
EXAMPLE_PATTERNS       = 
EXAMPLE_RECURSIVE      = NO
IMAGE_PATH             = 
INPUT_FILTER           = 
FILTER_PATTERNS        = 
FILTER_SOURCE_FILES    = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER         = NO
INLINE_SOURCES         = NO
STRIP_CODE_COMMENTS    = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION    = YES
REFERENCES_LINK_SOURCE = YES
USE_HTAGS              = NO
VERBATIM_HEADERS       = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX     = NO
COLS_IN_ALPHA_INDEX    = 5
IGNORE_PREFIX          = 
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML          = NO
HTML_OUTPUT            = html
HTML_FILE_EXTENSION    = .html
HTML_HEADER            = 
HTML_FOOTER            = 
HTML_STYLESHEET        = 
HTML_ALIGN_MEMBERS     = YES
GENERATE_HTMLHELP      = NO
HTML_DYNAMIC_SECTIONS  = NO
CHM_FILE               = 
HHC_LOCATION           = 
GENERATE_CHI           = NO
BINARY_TOC             = NO
TOC_EXPAND             = NO
DISABLE_INDEX          = NO
ENUM_VALUES_PER_LINE   = 4
GENERATE_TREEVIEW      = NO
TREEVIEW_WIDTH         = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX         = NO
LATEX_OUTPUT           = latex
LATEX_CMD_NAME         = latex
MAKEINDEX_CMD_NAME     = makeindex
COMPACT_LATEX          = NO
PAPER_TYPE             = a4wide
EXTRA_PACKAGES         = 
LATEX_HEADER           = 
PDF_HYPERLINKS         = NO
USE_PDFLATEX           = NO
LATEX_BATCHMODE        = NO
LATEX_HIDE_INDICES     = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF           = NO
RTF_OUTPUT             = rtf
COMPACT_RTF            = NO
RTF_HYPERLINKS         = NO
RTF_STYLESHEET_FILE    = 
RTF_EXTENSIONS_FILE    = 
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN           = NO
MAN_OUTPUT             = man
MAN_EXTENSION          = .3
MAN_LINKS              = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML           = YES
XML_OUTPUT             = doxygenoutput/
XML_SCHEMA             = 
XML_DTD                = 
XML_PROGRAMLISTING     = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF   = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD       = NO
PERLMOD_LATEX          = NO
PERLMOD_PRETTY         = YES
PERLMOD_MAKEVAR_PREFIX = 
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor   
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING   = YES
MACRO_EXPANSION        = YES
EXPAND_ONLY_PREDEF     = NO
SEARCH_INCLUDES        = YES
INCLUDE_PATH           = 
INCLUDE_FILE_PATTERNS  = 
PREDEFINED             = 
EXPAND_AS_DEFINED      = 
SKIP_FUNCTION_MACROS   = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references   
#---------------------------------------------------------------------------
TAGFILES               = 
GENERATE_TAGFILE       = 
ALLEXTERNALS           = NO
EXTERNAL_GROUPS        = YES
PERL_PATH              = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool   
#---------------------------------------------------------------------------
CLASS_DIAGRAMS         = NO
MSCGEN_PATH            = 
HIDE_UNDOC_RELATIONS   = YES
HAVE_DOT               = NO
CLASS_GRAPH            = NO
COLLABORATION_GRAPH    = NO
GROUP_GRAPHS           = NO
UML_LOOK               = NO
TEMPLATE_RELATIONS     = NO
INCLUDE_GRAPH          = NO
INCLUDED_BY_GRAPH      = NO
CALL_GRAPH             = NO
CALLER_GRAPH           = NO
GRAPHICAL_HIERARCHY    = NO
DIRECTORY_GRAPH        = NO
DOT_IMAGE_FORMAT       = png
DOT_PATH               = 
DOTFILE_DIRS           = 
DOT_GRAPH_MAX_NODES    = 50
MAX_DOT_GRAPH_DEPTH    = 0
DOT_TRANSPARENT        = NO
DOT_MULTI_TARGETS      = NO
GENERATE_LEGEND        = NO
DOT_CLEANUP            = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine   
#---------------------------------------------------------------------------
SEARCHENGINE           = NO
Comment 1 Jonas Truemper 2008-11-12 14:59:31 UTC
Created attachment 122500 [details]
testclass header file
Comment 2 Jonas Truemper 2008-11-12 15:02:24 UTC
Created attachment 122501 [details]
testclass implementation file
Comment 3 Jonas Truemper 2008-11-12 15:02:47 UTC
Created attachment 122502 [details]
doxygen config file
Comment 4 Dimitri van Heesch 2008-11-12 20:15:14 UTC
Did you know that closing a template with >> is not valid C++?
 
So you could also argue that there is a bug in your compiler if it accepts this broken code (VC++ does accept this, gcc does not, who do you think is more standards compliant? ;-).

Note that "typedef C<n>>m> T;" is valid C++, where >> is the shift operator, and this is handled correctly by doxygen.

For C# code doxygen does accept the >> as a way to end a template.

Comment 5 Jonas Truemper 2008-11-12 22:07:33 UTC
Hi Dimitri,

thanks for your immediate reply on this!

actually, you're right: I did not know this. And as I'm using VC++ the code compiles without any errors. So I guess I will have to check my code for errors like this.
Is there any switch for Doxygen I did not know yet to display/complain about errors like this? So I could quickly find out which files do contain errors like this..

Last but not least: thanks for this great tool! I'm using doxygen's xml output to analyze the static structure of source code which comes in very handy with doxygen!

So as the described behaviour is a feature and not a bug I guess you can close this one. :-)

Cheers,
Jonas
Comment 6 Dimitri van Heesch 2008-12-24 16:11:15 UTC
I'll leave this bug open as placeholder for other people running into the same issue. Adjusted summary accordingly.
Comment 7 Dimitri van Heesch 2009-01-25 11:06:14 UTC
*** Bug 527202 has been marked as a duplicate of this bug. ***
Comment 8 Dimitri van Heesch 2009-01-25 11:22:17 UTC
See http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=220 for a discussion on this issue.
Comment 9 David Legault 2009-02-28 02:22:13 UTC
With C++0x this is valid syntax under GCC 4.3.2+

I'm coding a new project using C++0x features and the issue with the old > > needing a space is resolved.

Doxygen should cope with the situation.

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html
Comment 10 Dimitri van Heesch 2009-04-03 14:34:38 UTC
David Legault wrote "Doxygen should cope with the situation". 
Ok, please add the patch that adds support for this then.
Comment 11 Dimitri van Heesch 2009-04-03 14:35:42 UTC
*** Bug 577464 has been marked as a duplicate of this bug. ***
Comment 12 Dimitri van Heesch 2009-07-06 17:50:44 UTC
*** Bug 587629 has been marked as a duplicate of this bug. ***
Comment 13 Dimitri van Heesch 2009-07-19 13:04:45 UTC
I'll implement approach 1 of the article mentioned in comment #9 to deal with this recurring issue.
Comment 14 Dimitri van Heesch 2009-08-20 10:13:18 UTC
This bug was previously marked ASSIGNED, which means it should be fixed in
doxygen version 1.6.0. Please verify if this is indeed the case and reopen the
bug if you think it is not fixed (include any additional information that you
think can be relevant).