This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Improve error messages
- To: gcc-patches at gcc dot gnu dot org
- Subject: [C++ PATCH] Improve error messages
- From: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Thu, 16 Nov 2000 12:04:10 +0000
- Organization: Codesourcery LLC
Hi,
I've installed the attached patch, prompted by bug 764. It makes the
error messages more understandable by changing such delights as
current/sebor.ii:11: no match for `*X&'
current/sebor.ii:12: no match for `+X&'
current/sebor.ii:13: no match for `X&[int]'
into
current/sebor.ii:11: no match for `* X&' operator
current/sebor.ii:12: no match for `+ X&' operator
current/sebor.ii:13: no match for `X& [int]' operator
built & tested on i686-pc-linux-gnu, approved by Mark,
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-11-15 Nathan Sidwell <nathan@codesourcery.com>
* call.c (op_error): Make error messages clearer.
Index: cp/call.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/call.c,v
retrieving revision 1.235
diff -c -3 -p -r1.235 call.c
*** call.c 2000/11/01 17:02:44 1.235
--- call.c 2000/11/14 16:39:02
*************** op_error (code, code2, arg1, arg2, arg3,
*** 2714,2720 ****
tree arg1, arg2, arg3;
const char *problem;
{
! const char * opname;
if (code == MODIFY_EXPR)
opname = assignment_operator_name_info[code2].name;
--- 2714,2720 ----
tree arg1, arg2, arg3;
const char *problem;
{
! const char *opname;
if (code == MODIFY_EXPR)
opname = assignment_operator_name_info[code2].name;
*************** op_error (code, code2, arg1, arg2, arg3,
*** 2724,2746 ****
switch (code)
{
case COND_EXPR:
! cp_error ("%s for `%T ? %T : %T'", problem,
error_type (arg1), error_type (arg2), error_type (arg3));
break;
case POSTINCREMENT_EXPR:
case POSTDECREMENT_EXPR:
! cp_error ("%s for `%T%s'", problem, error_type (arg1), opname);
break;
case ARRAY_REF:
! cp_error ("%s for `%T[%T]'", problem,
error_type (arg1), error_type (arg2));
break;
default:
if (arg2)
! cp_error ("%s for `%T %s %T'", problem,
error_type (arg1), opname, error_type (arg2));
else
! cp_error ("%s for `%s%T'", problem, opname, error_type (arg1));
}
}
--- 2724,2746 ----
switch (code)
{
case COND_EXPR:
! cp_error ("%s for `%T ? %T : %T' operator", problem,
error_type (arg1), error_type (arg2), error_type (arg3));
break;
case POSTINCREMENT_EXPR:
case POSTDECREMENT_EXPR:
! cp_error ("%s for `%T %s' operator", problem, error_type (arg1), opname);
break;
case ARRAY_REF:
! cp_error ("%s for `%T [%T]' operator", problem,
error_type (arg1), error_type (arg2));
break;
default:
if (arg2)
! cp_error ("%s for `%T %s %T' operator", problem,
error_type (arg1), opname, error_type (arg2));
else
! cp_error ("%s for `%s %T' operator", problem, opname, error_type (arg1));
}
}