This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Why does GCC Preprocessor NOT support such macro?
- From: John Graham <johngavingraham at googlemail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 23 Oct 2009 15:03:59 +0100
- Subject: Re: Why does GCC Preprocessor NOT support such macro?
- References: <000501ca53e8$f6aa8990$0101a8c0@huaweixczf0ea8>
2009/10/23 Zhang Lin <zhanglin0714@163.com>:
> Hello,
> I have encountered an issue when building ACE with MinGW and GCC 4.4.1
> The following macro was not accepted by the preprocessor and it reported such an error: "error: operator '==' has no left operand".
>
> #if !defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER)
> # define ACE_HAS_NONSTATIC_OBJECT_MANAGER
> #elif (ACE_HAS_NONSTATIC_OBJECT_MANAGER == 0)
> # undef ACE_HAS_NONSTATIC_OBJECT_MANAGER
> #endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER */
>
> As I think, since ACE_HAS_NONSTATIC_OBJECT_MANAGER isn't defined, the #elif branch should not be processed.
> This macro is accepted by VC7.1 and Sun Studio 12.
>
> Thanks.
>
> Best Regards,
> Lin Zhang
> 2009-10-23
You'll get this error if ACE_HAS_NONSTATIC_OBJECT_MANAGER is defined,
but has a null value - i.e. if somewhere before it was:
#define ACE_HAS_NONSTATIC_OBJECT_MANAGER
and not:
#define ACE_HAS_NONSTATIC_OBJECT_MANAGER 1
(for example)
I'm not sure if there's a way to test for a macro being null, but if
you change your previous declarations to defining it so something
instead of nothing, everything should be dandy.
John G