From: Zack Weinberg <zack@codesourcery.com>
To: Mark Mitchell <mark@codesourcery.com>
Cc: Joe Buck <jbuck@synopsys.com>, "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: gcc 3.2.1 draft release notes, 3rd draft
Date: Tue, 15 Oct 2002 19:11:00 -0000 [thread overview]
Message-ID: <20021016003507.GL15067@codesourcery.com> (raw)
In-Reply-To: <59720000.1034701726@warlock.codesourcery.com>
On Tue, Oct 15, 2002 at 10:08:46AM -0700, Mark Mitchell wrote:
> >Then how about adding a rule something like the following to the bison
> >grammar (yes, I know these are the wrong terminal names, but the idea
> >should be clear):
> >
> > TYPEDEF ID '=' error ';'
> > { error("Please use __typeof() instead");}
>
> Along these lines, one could perhaps even do the transformation at that
> point.
>
> TYPEDEF ID = expression ;
>
> { /* Do whatever you do for the typeof case. */ }
It's worth pointing out that the grammar does not distinguish between
typedef declarations and other declarations. It's all handled by
datadef: declspecs declarator '=' init ';'
(simplified for clarity) The present error message comes from the
semantics layer, c-decl.c:start_decl():
if (initialized)
/* Is it valid for this decl to have an initializer at all?
If not, set INITIALIZED to zero, which will indirectly
tell `finish_decl' to ignore the initializer once it is parsed. */
switch (TREE_CODE (decl))
{
case TYPE_DECL:
error ("typedef `%s' is initialized",
IDENTIFIER_POINTER (DECL_NAME (decl)));
initialized = 0;
break;
It would be easy to insert in here
advice ("Please use __typeof() instead");
("advice" is a diagnostic category I propose for helpful advice, such
as this, or the "Each undeclared identifier is reported only once"
message, which can be shut up with -fno-advice; right now, imagine
that it reads "error")
"Trying to do the above transformation" boils down to my original
patch that fixed the bug in the extension.
zw
next prev parent reply other threads:[~2002-10-16 0:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-14 17:38 Joe Buck
2002-10-15 1:27 ` Mark Mitchell
2002-10-15 10:10 ` Joe Buck
2002-10-15 11:33 ` Mark Mitchell
2002-10-15 19:11 ` Zack Weinberg [this message]
2002-10-15 21:19 ` Joe Buck
2002-10-18 4:48 ` Zack Weinberg
2002-10-18 5:17 ` Mark Mitchell
2002-10-18 7:42 ` John Marshall
2002-10-22 17:20 ` Zack Weinberg
2002-10-15 9:02 ` Alexandre Oliva
2002-10-15 9:18 ` Gabriel Dos Reis
2002-10-15 5:19 Reichelt
2002-10-15 13:00 Ulrich Weigand
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=20021016003507.GL15067@codesourcery.com \
--to=zack@codesourcery.com \
--cc=gcc@gcc.gnu.org \
--cc=jbuck@synopsys.com \
--cc=mark@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).