From: "Joseph S. Myers" <jsm@polyomino.org.uk>
To: Zack Weinberg <zack@codesourcery.com>
Cc: Per Bothner <per@bothner.com>, gcc@gcc.gnu.org
Subject: Re: #pragma interface/implementation broken if --enable-mapped-location
Date: Fri, 24 Sep 2004 22:15:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.61.0409242044090.10293@digraph.polyomino.org.uk> (raw)
In-Reply-To: <87zn3f2yx3.fsf@codesourcery.com>
On Fri, 24 Sep 2004, Zack Weinberg wrote:
> Suppose that cpplib, on encountering a #pragma, parsed the (namespace
> and) keyword to decide what it meant. If the #pragma was unknown, it
> would then throw away the entire line. If it was not unknown, it
> would inject a CPP_PRAGMA token at the beginning of the line *in place
> of* the token sequence # pragma [namespace] keyword. The value of
> this token would be a function pointer for the appropriate #pragma
> handler. I think that'd achieve both what you want and what I want,
> and would also avoid doing the handler lookup twice.
That should work (with the warning from -Wunknown-pragmas being given at
the point an unknown pragma is thrown away). For now yylex for C could
handle that pragma token by calling the handler immediately (so the
subsequent tokens never reach the parser). With the possibility of then
checking for particular pragmas and passing the token sequence on to the
parser for those cases only.
I'd add that the CPP_PRAGMA token, though referred to as __pragma,
shouldn't actually be spellable that way in source code; the only way to
get one in the token stream should be #pragma / _Pragma (and perhaps the
diagnostic messages complaining of such pragmas in bad places for the
grammar should use the spelling "#pragma" rather than "PRAGMA").
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
http://www.srcf.ucam.org/~jsm28/gcc/#c90status - status of C90 for GCC 4.0
jsm@polyomino.org.uk (personal mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)
next prev parent reply other threads:[~2004-09-24 20:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-24 2:08 Per Bothner
2004-09-24 2:22 ` Zack Weinberg
2004-09-24 2:43 ` Per Bothner
2004-09-24 4:58 ` Zack Weinberg
2004-09-24 14:17 ` Joseph S. Myers
2004-09-24 21:47 ` Zack Weinberg
2004-09-24 22:15 ` Joseph S. Myers [this message]
2004-09-24 22:34 ` Zack Weinberg
2004-09-29 19:24 ` Per Bothner
2004-09-29 20:56 ` Zack Weinberg
2004-09-29 21:57 ` Matt Austern
2004-09-29 22:50 ` Zack Weinberg
2004-09-30 7:57 ` Per Bothner
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=Pine.LNX.4.61.0409242044090.10293@digraph.polyomino.org.uk \
--to=jsm@polyomino.org.uk \
--cc=gcc@gcc.gnu.org \
--cc=per@bothner.com \
--cc=zack@codesourcery.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).