gcc: Include types in error message for build_binary_op.

Mostly cosmetic change, again to reduce differences with Apple's gcc.

Obtained from:	gcc 4.3 (rev. 125239; GPLv2)
MFC after:	3 weeks
This commit is contained in:
Pedro F. Giffuni 2013-12-06 02:19:58 +00:00
parent ac6cebeb9c
commit 36543c3739
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=259022
6 changed files with 21 additions and 8 deletions

View File

@ -57,6 +57,14 @@
operand.
(store_expr): Handle BLKmode moves by calling emit_block_move.
2007-05-31 Daniel Berlin <dberlin@dberlin.org> (r125239)
* c-typeck.c (build_indirect_ref): Include type in error message.
(build_binary_op): Pass types to binary_op_error.
* c-common.c (binary_op_error): Take two type arguments, print out
types with error.
* c-common.h (binary_op_error): Update prototype.
2007-05-27 Eric Christopher <echristo@apple.com> (r125116)
* config/rs6000/rs6000.c (rs6000_emit_prologue): Update

View File

@ -2019,10 +2019,10 @@ min_precision (tree value, int unsignedp)
}
/* Print an error message for invalid operands to arith operation
CODE. */
CODE with TYPE0 for operand 0, and TYPE1 for operand 1. */
void
binary_op_error (enum tree_code code)
binary_op_error (enum tree_code code, tree type0, tree type1)
{
const char *opname;
@ -2073,7 +2073,8 @@ binary_op_error (enum tree_code code)
default:
gcc_unreachable ();
}
error ("invalid operands to binary %s", opname);
error ("invalid operands to binary %s (have %qT and %qT)", opname,
type0, type1);
}
/* Subroutine of build_binary_op, used for comparison operations.

View File

@ -654,7 +654,7 @@ extern tree c_sizeof_or_alignof_type (tree, bool, int);
extern tree c_alignof_expr (tree);
/* Print an error message for invalid operands to arith operation CODE.
NOP_EXPR is used as a special case (see truthvalue_conversion). */
extern void binary_op_error (enum tree_code);
extern void binary_op_error (enum tree_code, tree, tree);
extern tree fix_string_type (tree);
struct varray_head_tag;
extern void constant_expression_warning (tree);

View File

@ -1923,7 +1923,7 @@ build_indirect_ref (tree ptr, const char *errorstring)
}
}
else if (TREE_CODE (pointer) != ERROR_MARK)
error ("invalid type argument of %qs", errorstring);
error ("invalid type argument of %qs (have %qT)", errorstring, type);
return error_mark_node;
}
@ -8135,7 +8135,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
|| !same_scalar_type_ignoring_signedness (TREE_TYPE (type0),
TREE_TYPE (type1))))
{
binary_op_error (code);
binary_op_error (code, type0, type1);
return error_mark_node;
}
@ -8431,7 +8431,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
if (!result_type)
{
binary_op_error (code);
binary_op_error (code, TREE_TYPE (op0), TREE_TYPE (op1));
return error_mark_node;
}

View File

@ -18,6 +18,10 @@
* decl2.c (determine_visibility): Remove duplicate code for
handling type info.
2007-05-31 Daniel Berlin <dberlin@dberlin.org> (r125239)
* typeck.c (build_binary_op): Include types in error.
2007-05-05 Geoffrey Keating <geoffk@apple.com> (r124467)
PR 31775

View File

@ -3476,7 +3476,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
|| !same_scalar_type_ignoring_signedness (TREE_TYPE (type0),
TREE_TYPE (type1)))
{
binary_op_error (code);
binary_op_error (code, type0, type1);
return error_mark_node;
}
arithmetic_types_p = 1;