GNOME Bugzilla – Bug 642148
namespace and initializer list in C++
Last modified: 2011-04-07 14:31:37 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.
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 ***
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
Created attachment 180776 [details] DemoBugDoxy2.zip : DemoBUG class with constructors etc.
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?
Created attachment 180788 [details] DemoBugDoxy3.zip : The DemoBUG class, The Doxyfile config and the html output.
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
Requested informations provided.
Fixed with 1.7.4