This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH c/40885] Fix build_indirect_ref i18n problems.


On Tue, 15 Dec 2009, Shujing Zhao wrote:

>    else if (TREE_CODE (pointer) != ERROR_MARK)
> -    error_at (loc,
> -	      "invalid type argument of %qs (have %qT)", errorstring, type);
> +    switch (errstring)
> +      {
> +         case RO_NULL:
> +           break;

The NULL case would previously have given an ICE, so I think you should 
remove this case and let it be handled by the default gcc_unreachable 
call, unless you have a case when this code could properly be reached with 
RO_NULL, in which case you should give an appropriate diagnostic.

> +         case RO_ARRAY_INDEXING:
> +           error_at (loc,
> +                     "invalid type argument of %<array indexing%> (have %qT)",
> +                     type);
> +           break;
> +         case RO_UNARY_STAR:
> +           error_at (loc,
> +                     "invalid type argument of %<unary *%> (have %qT)",
> +                     type);

I don't think you want to reproduce the oddities of the existing 
formatting, with quotes in those places; I think it would be better to say 
"of array indexing" (no %<%>) and "unary %<*%>".

> +           gcc_unreachable();

Missing space before ().  Same mistake elsewhere in this patch.

> +    switch (errorstring)
> +      {
> +         case RO_ARRAY_INDEXING:
> +           error ("invalid use of %<array indexing%> on pointer to member");
> +           break;
> +         case RO_UNARY_STAR:
> +           error ("invalid use of %<unary *%> on pointer to member");
> +           break;
> +         case RO_IMPLICIT_CONVERSION:
> +           error ("invalid use of %<implicit conversion%> "
> +                  "on pointer to member");

Likewise, regarding formatting of messages.

> +         case RO_ARRAY_INDEXING:
> +           error ("invalid type argument of %<array indexing%>");
> +           break;
> +         case RO_UNARY_STAR:
> +           error ("invalid type argument of %<unary *%>");
> +           break;
> +         case RO_IMPLICIT_CONVERSION:
> +           error ("invalid type argument of %<implicit conversion%>");

Likewise.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]