Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#if isn't recognized as a preprocessor, which is valid in C# (Origin: bugzilla #131989) #947

Closed
doxygen opened this issue Jul 1, 2018 · 0 comments

Comments

@doxygen
Copy link
Owner

doxygen commented Jul 1, 2018

status RESOLVED severity normal in component general for ---
Reported in version 1.3.x on platform Other
Assigned to: Dimitri van Heesch

On 2004-01-20 07:58:32 +0000, Haifeng Wang wrote:

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.

On 2006-09-17 10:31:06 +0000, Dimitri van Heesch wrote:

Can you please provide an example?

On 2006-10-23 21:00:33 +0000, Ben Voigt wrote:

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.

On 2008-08-24 09:45:10 +0000, Dimitri van Heesch wrote:

I get a "Content not found" error for that page. Any other info?

On 2008-08-25 13:10:07 +0000, Ben Voigt wrote:

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

On 2009-02-23 14:18:37 +0000, Tobias Mueller wrote:

Dimitri, you requested information has been provided in comment # 4. I am thus reopening.

On 2009-07-13 14:11:48 +0000, Slawomir Duszynski wrote:

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! :)

On 2009-07-18 18:09:03 +0000, Dimitri van Heesch wrote:

Thanks for the additional information. I'll implement this fix in the next subversion update.

On 2009-08-20 10:13:03 +0000, Dimitri van Heesch wrote:

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).

@doxygen doxygen closed this as completed Jul 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant