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 131989 - #if isn't recognized as a preprocessor, which is valid in C#
#if isn't recognized as a preprocessor, which is valid in C#
Status: RESOLVED FIXED
Product: doxygen
Classification: Other
Component: general
1.3.x
Other Windows
: Normal normal
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
Depends on:
Blocks:
 
 
Reported: 2004-01-20 07:58 UTC by Haifeng Wang
Modified: 2009-08-20 10:13 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Haifeng Wang 2004-01-20 07:58:32 UTC
Microsoft changes "#ifdef" to "if" in C# and managed C++. But doxygen
doesn't recognize it as a preprocessor. It will be great if doxygen can
recognize it.
Comment 1 Dimitri van Heesch 2006-09-17 10:31:06 UTC
Can you please provide an example?
Comment 2 Ben Voigt 2006-10-23 21:00:33 UTC
example at http://msdn.microsoft.com/library/en-us/csref/html/vclrfIf.asp?frame=true

More to the point, there is no change to the C++ behavior.  C# doesn't have proper macros, every #define'd value is treated as true.  So in a C# file, #define NAME should set NAME to 1 instead of the empty string.
Comment 3 Dimitri van Heesch 2008-08-24 09:45:10 UTC
I get a "Content not found" error for that page. Any other info?
Comment 4 Ben Voigt 2008-08-25 13:10:07 UTC
As is usual for the MSDN web site, it moved.

Here is the address for the newest documentation:
http://msdn.microsoft.com/en-us/library/4y6tbswk.aspx
Comment 5 Tobias Mueller 2009-02-23 14:18:37 UTC
Dimitri, you requested information has been provided in comment #4. I am thus reopening.
Comment 6 Slawomir Duszynski 2009-07-13 14:11:48 UTC
I would also very much like this bug to be fixed. C# preprocessor is more primitive than C/C++ one. The MSDN page provided in comment #4 contains all the info about it one might need.

Please consider the following short example:

#define DEF1
#define DEF2

using System;

namespace WindowsApplication1
{
    class Class2
    {
        private Class1 x = new Class1();

        public void y()
        {
#if DEF1 
            x.c();
#elif DEF2
            x.d();
#endif
         
        }
    }
}

In this case, x.c() will be called. If I remove the #define DEF1 line, x.d() will be called. However, Doxygen doesn't parse this syntax properly:

Class2.cs:17: Problem during constant expression evaluation: syntax error
Class2.cs:19: Problem during constant expression evaluation: syntax error

I suppose the previous comment gives the right solution idea: "So in a C# file,
#define NAME should set NAME to 1 instead of the empty string."

Thank you and keep up the good work! :)
Comment 7 Dimitri van Heesch 2009-07-18 18:09:03 UTC
Thanks for the additional information. I'll implement this fix in the next subversion update.
Comment 8 Dimitri van Heesch 2009-08-20 10:13:03 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).