This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH c/40885] Fix build_indirect_ref i18n problems.
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Shujing Zhao <pearly dot zhao at oracle dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Gabriel Dos Reis <gdr at integrable-solutions dot net>, Paolo Carlini <paolo dot carlini at oracle dot com>
- Date: Tue, 15 Dec 2009 15:26:45 +0000 (UTC)
- Subject: Re: [PATCH c/40885] Fix build_indirect_ref i18n problems.
- References: <4B272EE3.4060708@oracle.com>
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