public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Marek Polacek <polacek@redhat.com>
Cc: "Joseph S. Myers" <joseph@codesourcery.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix c_parser_for_statement for ObjC (PR objc/69844)
Date: Tue, 23 Feb 2016 19:49:00 -0000	[thread overview]
Message-ID: <20160223194915.GC3017@tucnak.redhat.com> (raw)
In-Reply-To: <20160223192406.GN14947@redhat.com>

On Tue, Feb 23, 2016 at 08:24:06PM +0100, Marek Polacek wrote:
> > --- gcc/c/c-parser.c.jj	2016-02-16 16:29:54.000000000 +0100
> > +++ gcc/c/c-parser.c	2016-02-18 17:36:55.025067859 +0100
> > @@ -5887,12 +5887,27 @@ c_parser_for_statement (c_parser *parser
> >      {
> >        c_token *token = c_parser_peek_token (parser);
> >        tree decl = lookup_name (token->value);
> > -      if (decl == NULL_TREE || VAR_P (decl))
> > -	/* If DECL is null, we don't know what this token might be.  Treat
> > -	   it as an ID for better diagnostics; we'll error later on.  */
> > -	token->id_kind = C_ID_ID;
> > -      else if (TREE_CODE (decl) == TYPE_DECL)
> > -	token->id_kind = C_ID_TYPENAME;
> > +      if (token->id_kind != C_ID_CLASSNAME)
> > +	{
> > +	  token->id_kind = C_ID_ID;
> 
> I think let's sink the lookup_name call here.  If id_kind is C_ID_CLASSNAME
> we're not looking at decl at all.

Done (and committed).  Thanks for review.

> > +	  if (decl)
> > +	    {
> > +	      if (TREE_CODE (decl) == TYPE_DECL)
> > +		token->id_kind = C_ID_TYPENAME;
> > +	    }
> > +	  else if (c_dialect_objc ())
> > +	    {
> > +	      tree objc_interface_decl = objc_is_class_name (token->value);
> 
> This objc_is_class_name is a weird stub that always returns NULL_TREE but

It is a weird stub only in the cc1 binary, in cc1obj binary it comes from
objc/objc-act.c and does various ObjC magic.

	Jakub

      reply	other threads:[~2016-02-23 19:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18 21:39 Jakub Jelinek
2016-02-22 19:34 ` Jeff Law
2016-02-23 19:24 ` Marek Polacek
2016-02-23 19:49   ` Jakub Jelinek [this message]

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=20160223194915.GC3017@tucnak.redhat.com \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=polacek@redhat.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).