public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Shujing Zhao <pearly.zhao@oracle.com>
Cc: Joseph <joseph@codesourcery.com>,
	Gcc-Patches <gcc-patches@gcc.gnu.org>,
	       Paolo Carlini <paolo.carlini@oracle.com>
Subject: Re: [PATCH C/C++] Fix some diagnostics problems
Date: Tue, 08 Jun 2010 19:08:00 -0000	[thread overview]
Message-ID: <4C0E94C8.4070807@redhat.com> (raw)
In-Reply-To: <4C0DC2B4.3080200@oracle.com>

On 06/08/2010 12:10 AM, Shujing Zhao wrote:
> 	* cp-tree.h (expr_list): New type.

Please call this expr_list_kind so people don't think it's a TREE_LIST. 
  Or don't bother giving it a name and just pass it as an int.

> 	(impl_conv_rhs): New type.

Why is this different in name and capitalization from impl_conv in the C 
front end?

> 	* decl.c (bad_spec): New enum.

This enum isn't telling us which bad specs we're dealing with, so the 
name is misleading.  Call it something like "bad_spec_place" or, as 
above, don't give it a name.

> +	  case EL_FUNC_CAST:
> +	    permerror (input_location, "function cast expression "
> +	    			       "list treated as compound expression");

"functional cast", not "function cast".

>        if (TREE_CODE (decl) == RESULT_DECL)
> -	init = build_x_compound_expr_from_list (init,
> -						"return value initializer");
> +	init = build_x_compound_expr_from_list (init, EL_RETURN_VAL_INIT);

I believe this code is a relic of the old named return value extension, 
and can be removed along with EL_RETURN_VAL_INIT.

While we're messing with these messages I'd also like to reword them a 
bit: rather than

"initializer expression list treated as compound expression"

let's say

"expression list treated as compound expression in initializer"

and so on.

> +		    case ICR_DEFAULT_ARGUMENT:
> +		      error ("cannot convert %qT to %qT in default argument",
> +			     rhstype, type);
> +		    case ICR_ARGPASS:
> +		      error ("cannot convert %qT to %qT in argument passing",
> +			     rhstype, type);
> +		      break;

These cases are unreachable, as they are covered by the previous if 
(fndecl) test.  Either remove the if (fndecl) message and use 
parmnum/fndecl in these cases, or just use gcc_unreachable() in these cases.

> +		      error ("cannot convert %qT to %qT in converting",
> +			     rhstype, type);

Drop "in converting".

> +	    case ICR_DEFAULT_ARGUMENT:
> +	      warning (OPT_Wmissing_format_attribute,
> +		       "default argument might be a candidate "
> +		       "for a format attribute");

"parameter %d of %qD might be [...]", parmnum, fndecl

> +	      break;
> +	    case ICR_CONVERTING:
> +	      warning (OPT_Wmissing_format_attribute,
> +		       "converting might be a candidate "
> +		       "for a format attribute");

"target of conversion might be [...]"

> +	      break;
> +	    case ICR_INIT:
> +	      warning (OPT_Wmissing_format_attribute,
> +		       "initialization might be a candidate "
> +		       "for a format attribute");

"target of initialization might be..."

> +	      break;
> +	    case ICR_ARGPASS:
> +	      warning (OPT_Wmissing_format_attribute,
> +		       "argument passing might be a candidate "
> +		       "for a format attribute");
> +	      break;

Same as ICR_DEFAULT_ARGUMENT.

> +	    case ICR_RETURN:
> +	      warning (OPT_Wmissing_format_attribute,
> +		       "return might be a candidate for a format attribute");
> +	      break;

"return type might..."

> +	    case ICR_ASSIGN:
> +	      warning (OPT_Wmissing_format_attribute,
> +		       "assignment might be a candidate "
> +		       "for a format attribute");

"left-hand side of assignment might..."

Jason

WARNING: multiple messages have this Message-ID
From: Jason Merrill <jason@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: Joseph <joseph@codesourcery.com>,
	 Gcc-Patches <gcc-patches@gcc.gnu.org>,
	Paolo Carlini <paolo.carlini@oracle.com>
Subject: Re: [PATCH C/C++] Fix some diagnostics problems
Date: Tue, 08 Jun 2010 19:11:00 -0000	[thread overview]
Message-ID: <4C0E94C8.4070807@redhat.com> (raw)
Message-ID: <20100608191100.jNrd5eby3MeYQ6gFsFaenTtiapg0-IGWouHkNgZOYu4@z> (raw)
In-Reply-To: <4C0DC2B4.3080200@oracle.com>

On 06/08/2010 12:10 AM, Shujing Zhao wrote:
> 	* cp-tree.h (expr_list): New type.

Please call this expr_list_kind so people don't think it's a TREE_LIST. 
  Or don't bother giving it a name and just pass it as an int.

> 	(impl_conv_rhs): New type.

Why is this different in name and capitalization from impl_conv in the C 
front end?

> 	* decl.c (bad_spec): New enum.

This enum isn't telling us which bad specs we're dealing with, so the 
name is misleading.  Call it something like "bad_spec_place" or, as 
above, don't give it a name.

> +	  case EL_FUNC_CAST:
> +	    permerror (input_location, "function cast expression "
> +	    			       "list treated as compound expression");

"functional cast", not "function cast".

>        if (TREE_CODE (decl) == RESULT_DECL)
> -	init = build_x_compound_expr_from_list (init,
> -						"return value initializer");
> +	init = build_x_compound_expr_from_list (init, EL_RETURN_VAL_INIT);

I believe this code is a relic of the old named return value extension, 
and can be removed along with EL_RETURN_VAL_INIT.

While we're messing with these messages I'd also like to reword them a 
bit: rather than

"initializer expression list treated as compound expression"

let's say

"expression list treated as compound expression in initializer"

and so on.

> +		    case ICR_DEFAULT_ARGUMENT:
> +		      error ("cannot convert %qT to %qT in default argument",
> +			     rhstype, type);
> +		    case ICR_ARGPASS:
> +		      error ("cannot convert %qT to %qT in argument passing",
> +			     rhstype, type);
> +		      break;

These cases are unreachable, as they are covered by the previous if 
(fndecl) test.  Either remove the if (fndecl) message and use 
parmnum/fndecl in these cases, or just use gcc_unreachable() in these cases.

> +		      error ("cannot convert %qT to %qT in converting",
> +			     rhstype, type);

Drop "in converting".

> +	    case ICR_DEFAULT_ARGUMENT:
> +	      warning (OPT_Wmissing_format_attribute,
> +		       "default argument might be a candidate "
> +		       "for a format attribute");

"parameter %d of %qD might be [...]", parmnum, fndecl

> +	      break;
> +	    case ICR_CONVERTING:
> +	      warning (OPT_Wmissing_format_attribute,
> +		       "converting might be a candidate "
> +		       "for a format attribute");

"target of conversion might be [...]"

> +	      break;
> +	    case ICR_INIT:
> +	      warning (OPT_Wmissing_format_attribute,
> +		       "initialization might be a candidate "
> +		       "for a format attribute");

"target of initialization might be..."

> +	      break;
> +	    case ICR_ARGPASS:
> +	      warning (OPT_Wmissing_format_attribute,
> +		       "argument passing might be a candidate "
> +		       "for a format attribute");
> +	      break;

Same as ICR_DEFAULT_ARGUMENT.

> +	    case ICR_RETURN:
> +	      warning (OPT_Wmissing_format_attribute,
> +		       "return might be a candidate for a format attribute");
> +	      break;

"return type might..."

> +	    case ICR_ASSIGN:
> +	      warning (OPT_Wmissing_format_attribute,
> +		       "assignment might be a candidate "
> +		       "for a format attribute");

"left-hand side of assignment might..."

Jason

  parent reply	other threads:[~2010-06-08 19:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-08  4:13 Shujing Zhao
2010-06-08 10:42 ` Joseph S. Myers
2010-06-08 13:45   ` Gabriel Dos Reis
2010-06-08 19:08 ` Jason Merrill [this message]
2010-06-08 19:11   ` Jason Merrill
2010-06-09  3:20   ` Shujing Zhao
2010-06-09  4:39     ` Jason Merrill
2010-06-09  9:23   ` Shujing Zhao
2010-06-09 13:00     ` Jason Merrill
2010-06-10  7:07       ` Shujing Zhao
2010-06-10 13:13         ` Jason Merrill
2010-06-11  6:02           ` Shujing Zhao
2010-06-11  9:33             ` Manuel López-Ibáñez
2010-06-11  9:40       ` Manuel López-Ibáñez
2010-06-11 10:50         ` Shujing Zhao
2010-06-11 11:22           ` Manuel López-Ibáñez
2010-06-12  7:55             ` Shujing Zhao
2010-06-12 13:44               ` Jason Merrill
  -- strict thread matches above, loose matches on Subject: below --
2010-06-04  9:39 Shujing Zhao
2010-06-05 13:18 ` Joseph S. Myers
2010-06-07  9:33   ` Shujing Zhao
2010-06-07 13:27     ` Joseph S. Myers
2010-06-08  4:09       ` 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=4C0E94C8.4070807@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.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).