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 642148 - namespace and initializer list in C++
namespace and initializer list in C++
Status: RESOLVED FIXED
Product: doxygen
Classification: Other
Component: general
1.7.3
Other Windows
: Normal normal
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
Depends on:
Blocks:
 
 
Reported: 2011-02-12 05:59 UTC by Valkea
Modified: 2011-04-07 14:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
DemoBugDoxy.zip : A zip file containing 3 demo class and the Doxyfile (20.93 KB, application/x-zip-compressed)
2011-02-12 05:59 UTC, Valkea
Details
DemoBugDoxy2.zip : DemoBUG class with constructors etc. (1.23 KB, application/x-zip-compressed)
2011-02-13 14:52 UTC, Valkea
Details
DemoBugDoxy3.zip : The DemoBUG class, The Doxyfile config and the html output. (60.29 KB, application/x-zip-compressed)
2011-02-13 20:11 UTC, Valkea
Details

Description Valkea 2011-02-12 05:59:01 UTC
Created attachment 180702 [details]
DemoBugDoxy.zip : A zip file containing 3 demo class and the Doxyfile

Hello,

when I use namespaces and initializer lists in C++, the initialized members are listed as Function under the namespace page in the Doxygen doc.


Example :

**DebugBUG.h***************************

#ifndef HEADER_BUG
#define HEADER_BUG

namespace hbt /// The demo namespace
{
	// Removed everything to avoid problems to find the bug
}

#endif

***************************************

with

**DebugBUG.cpp*************************

#include "DemoBUG.h"

namespace hbt
{
	DemoBUG::DemoBUG() : DEMO_BUG_A(1), DEMO_BUG_B(1), DEMO_BUG_C(1) , DEMO_BUG_D(1) , DEMO_BUG_E(1) 
	{
		//...
	}
}

***************************************

produce the following Doxygen documentation (even if the class, methods and members are declared in the header file).

***************************************
hbt Namespace Reference

The demo namespace. More...
Functions
F 	DEMO_BUG_B (1)
F 	DEMO_BUG_C (1)
F 	DEMO_BUG_D (1)
F 	DEMO_BUG_E (1)
Variables
F 	__pad0__
***************************************

As you can see each member variable initialized with the constructor is listed as a Function except the first one (DEMO_BUG_A). Furthermore a special __pad0__ variable appear from nowhere. 

I found 2 solutions to avoid the problem :

1. define the constructor with the namespace instead of including it in the namespace
***************************************
// Problem solved ba adding the namespace in front of the constructor

hbt::DemoOK_1::DemoOK_1() : DEMO_OK_1_A(1), DEMO_OK_1_B(1), DEMO_OK_1_C(1) , DEMO_OK_1_D(1) , DEMO_OK_1_F(1)
{
	//...
}
***************************************

2. insert a ";" before the constructor
***************************************
namespace hbt
{
	; // Problem solved by adding ";" 
	
	DemoOK_2::DemoOK_2() : DEMO_OK_2_A(1), DEMO_OK_2_B(1), DEMO_OK_2_C(1) , DEMO_OK_2_D(1) , DEMO_OK_2_F(1)
	{
		//...
	}
}
***************************************

Unfortunately, I did not found how to avoid the __pad0__ variable.

I hope this is cleaned enough to help solving this problem.
Thank you for your great job.
Comment 1 Dimitri van Heesch 2011-02-13 09:45:53 UTC
I think you stripped a bit too much from your example (there is not even a class definition left), so I cannot reproduce the problem with the example provided (did you actually try it yourself with the attached files?). 

I expect this is the same problem as bug 639716, if not please attach a self contained example for which you verified it contains the problem.

*** This bug has been marked as a duplicate of bug 639716 ***
Comment 2 Valkea 2011-02-13 14:51:20 UTC
Hello,

You can eventually consider the __pad0__ part as a duplicate of the other bug you pointed out, but the "initializer list" bug is not in any way described in the other bug report.

Indeed you can't compile the C++ source code as I removed almost all the code, but it does produce the same Doxygen documentation with or without the full code. That's why I removed almost all the C++ code that can't be used to find the Doxygen parsing bug.

The fact is that the second plus parameters of an the first "initializer list" of a cpp file is considered as a function list by Doxygen (did not verified if it occurs even without the namespace) instead of not being considered at all (as they are not definitions but declarations)

This does not occurs with a second initializer list later in the same cpp file (with a second class constructor).

This time I attach a fully functional class with DemoBUG initialized in the main.cpp (DemoBugDoxy2.zip)

Thank you for all your efforts,
and good luck with this.

Valkea
Comment 3 Valkea 2011-02-13 14:52:45 UTC
Created attachment 180776 [details]
DemoBugDoxy2.zip : DemoBUG class with constructors etc.
Comment 4 Dimitri van Heesch 2011-02-13 15:24:14 UTC
I'm still not able to reproduce the issue with the new example. Can you also attach the config file that you used to verify that this example indeed shows the problem?
Comment 5 Valkea 2011-02-13 20:11:16 UTC
Created attachment 180788 [details]
DemoBugDoxy3.zip : The DemoBUG class, The Doxyfile config and the html output.
Comment 6 Valkea 2011-02-13 20:14:47 UTC
Sure I can. (The config file, was in the first zip, but was configured to being run from the html directory itself, this way the doc, config and exe are in the same directory)

This zip (DemoBugDoxy3.zip) contains The DemoBUG class, The Doxyfile config file and the html output as it is small.

(this time the config file is created to be run from the same directory as the Doxyfile not from the html dir as the previous one, sorry for forgetting that).

Good luck,
Valkea
Comment 7 Valkea 2011-03-08 00:24:46 UTC
Requested informations provided.
Comment 8 Valkea 2011-04-07 14:31:37 UTC
Fixed with 1.7.4