public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
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 14:17:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.61.0409240859290.31590@digraph.polyomino.org.uk> (raw)
In-Reply-To: <876564cqyo.fsf@codesourcery.com>

On Thu, 23 Sep 2004, Zack Weinberg wrote:

> Alternatively, I wanted originally to defer pragmas not by
> encapsulating the un-tokenized line in a string, but by injecting a
> keyword (__pragma) at the beginning of the line, a semicolon at the
> end, and tokenizing normally (but with macro expansion disabled).
> Matt persuaded me that was hard to implement, but maybe it should be
> revisited.

That would also probably be convenient for OpenMP pragma implementation 
for C (where the pragmas can contain expressions that need to go through 
the parser as usual).  But for most target pragmas attempting to hook them 
in the grammar like that would seem an excess complication; the grammar 
would effectively just gather up a sequence of arbitrary tokens again to 
pass to the target pragma handler.  (Bearing in mind the general 
desirability that target pragmas share a single implementation for C and 
C++.)

I don't care for having three separate paths for pragma handling 
(immediate on lexing, deferred as a pragma token, deferred as a sequence 
of tokens), which suggests making C use the pragma token (but handle it 
immediately on parsing) and then allow for some pragmas - depending on the 
individual pragma - to become token sequences instead.

I wonder if also the check for unrecognized pragmas should be made before 
the pragma becomes any sort of token, on the basis that the C and C++ 
standards explicitly say that unknown pragmas are ignored (and so should 
be permitted anywhere in the source file, not just in reasonable places).  
That would seem cleaner than documenting that all pragmas are recognized 
in order to give errors if they occur in an inconvenient place.

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

  reply	other threads:[~2004-09-24  9:17 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 [this message]
2004-09-24 21:47         ` Zack Weinberg
2004-09-24 22:15           ` Joseph S. Myers
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.0409240859290.31590@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).