diff --git a/contrib/gcc/ChangeLog.gcc43 b/contrib/gcc/ChangeLog.gcc43 index 8311fc96467b..acb1ddc25257 100644 --- a/contrib/gcc/ChangeLog.gcc43 +++ b/contrib/gcc/ChangeLog.gcc43 @@ -57,6 +57,14 @@ operand. (store_expr): Handle BLKmode moves by calling emit_block_move. +2007-05-31 Daniel Berlin (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 (r125116) * config/rs6000/rs6000.c (rs6000_emit_prologue): Update diff --git a/contrib/gcc/c-common.c b/contrib/gcc/c-common.c index d358a79bab61..b97bb721b411 100644 --- a/contrib/gcc/c-common.c +++ b/contrib/gcc/c-common.c @@ -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. diff --git a/contrib/gcc/c-common.h b/contrib/gcc/c-common.h index fb9ea9e24458..8848ea5fdaf0 100644 --- a/contrib/gcc/c-common.h +++ b/contrib/gcc/c-common.h @@ -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); diff --git a/contrib/gcc/c-typeck.c b/contrib/gcc/c-typeck.c index 3e47837c7624..dd59620fece1 100644 --- a/contrib/gcc/c-typeck.c +++ b/contrib/gcc/c-typeck.c @@ -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; } diff --git a/contrib/gcc/cp/ChangeLog.gcc43 b/contrib/gcc/cp/ChangeLog.gcc43 index 24e79eea45d2..caf9dd2dc002 100644 --- a/contrib/gcc/cp/ChangeLog.gcc43 +++ b/contrib/gcc/cp/ChangeLog.gcc43 @@ -18,6 +18,10 @@ * decl2.c (determine_visibility): Remove duplicate code for handling type info. +2007-05-31 Daniel Berlin (r125239) + + * typeck.c (build_binary_op): Include types in error. + 2007-05-05 Geoffrey Keating (r124467) PR 31775 diff --git a/contrib/gcc/cp/typeck.c b/contrib/gcc/cp/typeck.c index d0334ddf5327..34a301d62fa3 100644 --- a/contrib/gcc/cp/typeck.c +++ b/contrib/gcc/cp/typeck.c @@ -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;