From: Reza Roboubi <reza@parvan.net>
To: David Sveningsson <ext@sidvind.com>, gcc-help@gcc.gnu.org
Subject: Re: inconsistent macro behavior
Date: Mon, 28 Jul 2008 12:57:00 -0000 [thread overview]
Message-ID: <488DB86E.3010909@parvan.net> (raw)
In-Reply-To: <488D68C3.9090404@sidvind.com>
David Sveningsson wrote:
>> The questions are:
>> a.) What's even going on here? Why the apparent inconsistency?
>> b.) What _should_ be the correct behavior, both in terms of the
>> (extended) GNU C language, and also the standard C language?
>
> I believe that each c-style string must be encapsulated with " even for
> the preprocessor to work. Actually, at least gcc-4.3 emits warnings
> about missing termination for both line 1 and 2 in your test case.
>
> Perhaps you could work something out with the ## concatenation operator?
Thanks for your replies.
So, double quotes are needed, but I'm still wondering why these behave
differently:
$ gcc -Wall -E test.c
$ gcc -Wall -c test.c
I mean, what does the gcc back end do _differently_ for those two commands?
---------------------------------------
As a side note, I just checked Torvalds' sparse compiler, and
interestingly, it returns:
test.c:2:1: warning: Newline in string or character constant
char * c = "llll\n#define y " y ;
In other words, it is amalgamating lines 1+2 into a single string
literal. However, sparse does this consistently, regardless of of
whether I use sparse -E or sparse -c. So, I can understand what it's doing.
Reza.
next prev parent reply other threads:[~2008-07-28 12:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-28 7:29 Reza Roboubi
2008-07-28 8:36 ` David Sveningsson
2008-07-28 12:57 ` Reza Roboubi [this message]
2008-07-28 12:28 ` Reza Roboubi
[not found] <1217227025.3398.ezmlm@gcc.gnu.org>
2008-07-28 8:41 ` Jay
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=488DB86E.3010909@parvan.net \
--to=reza@parvan.net \
--cc=ext@sidvind.com \
--cc=gcc-help@gcc.gnu.org \
/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).