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 634775 - C++ // style comments that start a line in \code section doesn't work
C++ // style comments that start a line in \code section doesn't work
Status: RESOLVED FIXED
Product: doxygen
Classification: Other
Component: general
1.7.2
Other Windows
: Normal normal
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
Depends on:
Blocks:
 
 
Reported: 2010-11-13 20:37 UTC by Cleo Saulnier
Modified: 2011-01-03 19:01 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Cleo Saulnier 2010-11-13 20:37:13 UTC
\code
// This is a comment for my code.
struct bla
{
 int val;
}
\endcode

The above would delete // and treat the rest of the line as code with syntax highlighting.  The word 'for' would be a different color because it is a reserved word.

Spaces and tabs beforehand don't change anything.  The // still gets deleted.

Note that a comment after existing code on the same line is fine.

\code
int val; // My value
\endcode

This works fine.
Comment 1 Dimitri van Heesch 2010-11-14 08:39:54 UTC
Hi Cleo, I tried to reproduce with this minimal example:

---------------------------------------
/** Look at this code fragment:
 \code
 // This is a comment for my code.
 struct bla
 {
 int val;
 }
 \endcode
*/
class Test
{
};
---------------------------------------

and a default config file, but it work fine.

Can you please attach a self-contained example (source+config file in a tar or zip) that allows me to reproduce the problem?
Comment 2 Cleo Saulnier 2010-11-14 15:20:52 UTC
I've traced the problem to an inner class.  Here is the example I have.  Just save it, update the filename at the top and use default settings.  I can send a zip if this doesn't work.

------------------------
/*! \file CSIndexedSkipList.h
*/

class bla
{
  //! Used to initialize probability in list constructor.
  struct Prob
  {
    double probability; //!< Probability that node will have another level.
    size_type maxLevel; //!< Maximum number of levels allowed.
    //! Set probability to 0.25 and calculate maxLevel based on maxNodes.
    Prob(size_type maxNodes)  {}
    //! Set probability and maximum number of levels directly.
    Prob(double probability, size_type maxLevel) {}
  };
};


/*! \mainpage
\code
// This is not ok
class blorg
{
  int val; // This is ok
};
\endcode

*/

--------------------------------

That's it.  BTW, if I put the class after the mainpage section (it can be any page), the comments show up correctly.  I have a rather large project and even if I do this, the comments still don't show up.  I can say that this problem spans files.  I'm guessing that as soon as it reads that class in, the problem persists throughout the project.  I have other inner classes elsewhere that may cause the same problem.

What's REALLY weird is that if I remove the following line, the problem goes away.

    //! Set probability to 0.25 and calculate maxLevel based on maxNodes.
Comment 3 Dimitri van Heesch 2010-11-14 16:51:08 UTC
I've found the problem. It was quite subtle indeed. 
It should be fixed in the next subversion update.
Comment 4 Dimitri van Heesch 2011-01-03 19:01:39 UTC
This bug was previously marked ASSIGNED, which means it should be fixed in
doxygen version 1.7.3. 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.