public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Joseph S. Myers" <joseph@codesourcery.com>
To: Shujing Zhao <pearly.zhao@oracle.com>
Cc: "GCC Patches" <gcc-patches@gcc.gnu.org>,
	"Manuel López-Ibáñez" <lopezibanez@gmail.com>,
	"Paolo Carlini" <paolo.carlini@oracle.com>
Subject: Re: [PATCH C] Fix pr44517
Date: Tue, 22 Jun 2010 13:36:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.1006221246280.729@digraph.polyomino.org.uk> (raw)
In-Reply-To: <4C2060CC.3040401@oracle.com>

On Tue, 22 Jun 2010, Shujing Zhao wrote:

> Hi,
> 
> This patch tries to improve diagnostic for wrong type name in function
> declaration. It also changes the algorithm of function
> c_parser_parms_list_declarator. If one of parameter declaration is wrong,
> c_parser_parms_list_declarator would return NULL, not an empty parameter
> information struct. A test case is added to test this change.

You are changing the semantics of the variable good_parm from meaning 
"there was at least one good parameter" to "there were no bad parameters".  
Now, such a change should be accompanied by a change of name (e.g. to 
bad_parm, also reversing the sense of the variable).

There was a previous invariant that get_pending_sizes would be called 
after any parameters were parsed, either directly or via get_parm_info 
because good_parm would be set, and with this patch, this invariant is no 
longer maintained.  This is unsafe; you need to run this cleanup, whatever 
you then return from c_parser_parms_list_declarator.  Consider for example 
the testcase:

void foo(int n, int a[n], pid_t x);
void bar() {}

(related to gcc.dg/noncompile/pr35444-*.c).  With your patch, this 
testcase (which should be added to the next revision of the patch) gets an 
ICE, because you lost the call to get_pending_sizes via get_parm_info.

> +      error ("unknown type name %qE", token->value);

I don't think %qE is appropriate here if the token is not an identifier.

-- 
Joseph S. Myers
joseph@codesourcery.com

  parent reply	other threads:[~2010-06-22 12:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-22  8:14 Shujing Zhao
2010-06-22  8:49 ` Manuel López-Ibáñez
2010-06-22  9:57   ` Shujing Zhao
2010-06-22 10:00     ` Manuel López-Ibáñez
2010-06-22 13:36 ` Joseph S. Myers [this message]
2010-06-23  9:17   ` Shujing Zhao
2010-06-23  9:31     ` Manuel López-Ibáñez
2010-06-23  9:55       ` Shujing Zhao
2010-06-23 12:24     ` Joseph S. Myers
2010-06-23 12:28       ` Manuel López-Ibáñez
2010-06-23 12:41         ` Joseph S. Myers
2010-06-24 10:50           ` Shujing Zhao
2010-06-24 11:56             ` Joseph S. Myers
2010-06-25 10:02               ` Shujing Zhao

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.64.1006221246280.729@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=lopezibanez@gmail.com \
    --cc=paolo.carlini@oracle.com \
    --cc=pearly.zhao@oracle.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).