From: Jean Christophe Beyler <jean.christophe.beyler@gmail.com>
To: Zhang Lin <zhanglin0714@163.com>
Cc: John Graham <johngavingraham@googlemail.com>, gcc@gcc.gnu.org
Subject: Re: Why does GCC Preprocessor NOT support such macro?
Date: Fri, 23 Oct 2009 21:56:00 -0000 [thread overview]
Message-ID: <c568a2600910231207p391f3e3dy4b929adbab98103b@mail.gmail.com> (raw)
In-Reply-To: <004801ca53fe$d9536400$0101a8c0@huaweixczf0ea8>
It works no problem for me.
This is what I get:
$ gcc -Wall -o "Test.exe" "macro.cpp" -lstdc++ -s -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ./configure --enable-compiler=c --enable-language=c
--prefix=/home/beyler/tmp/gcc-4.3.2/bin
Thread model: posix
gcc version 4.3.2 (GCC)
COLLECT_GCC_OPTIONS='-Wall' '-o' 'Test.exe' '-s' '-v' '-mtune=generic'
/home/beyler/tmp/gcc-4.3.2/bin/libexec/gcc/i686-pc-linux-gnu/4.3.2/cc1plus
-quiet -v -D_GNU_SOURCE macro.cpp -quiet -dumpbase macro.cpp
-mtune=generic -auxbase macro -Wall -version -o /tmp/ccx2HphX.s
ignoring nonexistent directory
"/home/beyler/tmp/gcc-4.3.2/bin/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/home/beyler/tmp/gcc-4.3.2/bin/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../include/c++/4.3.2
/home/beyler/tmp/gcc-4.3.2/bin/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../include/c++/4.3.2/i686-pc-linux-gnu
/home/beyler/tmp/gcc-4.3.2/bin/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../include/c++/4.3.2/backward
/usr/local/include
/home/beyler/tmp/gcc-4.3.2/bin/include
/home/beyler/tmp/gcc-4.3.2/bin/lib/gcc/i686-pc-linux-gnu/4.3.2/include
/home/beyler/tmp/gcc-4.3.2/bin/lib/gcc/i686-pc-linux-gnu/4.3.2/include-fixed
/usr/include
End of search list.
GNU C++ (GCC) version 4.3.2 (i686-pc-linux-gnu)
compiled by GNU C version 4.3.2, GMP version 4.2.2, MPFR version 2.3.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 80f643acb5e6c86441cd11d3ee5d089a
COLLECT_GCC_OPTIONS='-Wall' '-o' 'Test.exe' '-s' '-v' '-mtune=generic'
as -V -Qy -o /tmp/cccKZT5N.o /tmp/ccx2HphX.s
GNU assembler version 2.18.93 (i486-linux-gnu) using BFD version (GNU
Binutils for Ubuntu) 2.18.93.20081009
COMPILER_PATH=/home/beyler/tmp/gcc-4.3.2/bin/libexec/gcc/i686-pc-linux-gnu/4.3.2/:/home/beyler/tmp/gcc-4.3.2/bin/libexec/gcc/i686-pc-linux-gnu/4.3.2/:/home/beyler/tmp/gcc-4.3.2/bin/libexec/gcc/i686-pc-linux-gnu/:/home/beyler/tmp/gcc-4.3.2/bin/lib/gcc/i686-pc-linux-gnu/4.3.2/:/home/beyler/tmp/gcc-4.3.2/bin/lib/gcc/i686-pc-linux-gnu/
LIBRARY_PATH=/home/beyler/tmp/gcc-4.3.2/bin/lib/gcc/i686-pc-linux-gnu/4.3.2/:/home/beyler/tmp/gcc-4.3.2/bin/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-Wall' '-o' 'Test.exe' '-s' '-v' '-mtune=generic'
/home/beyler/tmp/gcc-4.3.2/bin/libexec/gcc/i686-pc-linux-gnu/4.3.2/collect2
--eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o
Test.exe -s /usr/lib/crt1.o /usr/lib/crti.o
/home/beyler/tmp/gcc-4.3.2/bin/lib/gcc/i686-pc-linux-gnu/4.3.2/crtbegin.o
-L/home/beyler/tmp/gcc-4.3.2/bin/lib/gcc/i686-pc-linux-gnu/4.3.2
-L/home/beyler/tmp/gcc-4.3.2/bin/lib/gcc/i686-pc-linux-gnu/4.3.2/../../..
/tmp/cccKZT5N.o -lstdc++ -lgcc --as-needed -lgcc_s --no-as-needed -lc
-lgcc --as-needed -lgcc_s --no-as-needed
/home/beyler/tmp/gcc-4.3.2/bin/lib/gcc/i686-pc-linux-gnu/4.3.2/crtend.o
/usr/lib/crtn.o
On Fri, Oct 23, 2009 at 12:35 PM, Zhang Lin <zhanglin0714@163.com> wrote:
> Sorry, maybe my representation is not quite clear.
> I mean that I didn't define ACE_HAS_NONSTATIC_OBJECT_MANAGER at all, so the preprocesser should not process "#elif (ACE_HAS_NONSTATIC_OBJECT_MANAGER == 0)", the following simple cpp can reproduce the problem.
>
> Test.cpp
> ==========
> #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 */
>
> int main(int argc, char *argv[])
> {
> return 0;
> }
> ==========
>
> the compile command is:
> gcc -Wall -o "Test.exe" "Test.cpp" -lstdc++ -s
>
> and the error message is:
> Test.cpp:3:41: error: operator '==' has no left operand
>
>
> ----- Original Message -----
> From: "John Graham" <johngavingraham@googlemail.com>
> To: <gcc@gcc.gnu.org>
> Sent: Friday, October 23, 2009 10:03 PM
> Subject: Re: Why does GCC Preprocessor NOT support such macro?
>
>
>> 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
>>
next prev parent reply other threads:[~2009-10-23 19:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-23 14:05 Zhang Lin
2009-10-23 14:15 ` John Graham
2009-10-23 18:21 ` Zhang Lin
2009-10-23 21:56 ` Jean Christophe Beyler [this message]
2009-10-23 22:46 ` Andrew Pinski
2009-10-27 22:55 ` Jakub Jelinek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c568a2600910231207p391f3e3dy4b929adbab98103b@mail.gmail.com \
--to=jean.christophe.beyler@gmail.com \
--cc=gcc@gcc.gnu.org \
--cc=johngavingraham@googlemail.com \
--cc=zhanglin0714@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).