Commit d9637168 by Jason Merrill

c-family: Remove location parm from unsafe_conversion_p.

My earlier change removed the warning calls from this function, so the
location is no longer useful.

	* c-common.c (unsafe_conversion_p): Remove location parm.
parent 9085381f
...@@ -1324,14 +1324,11 @@ int_safely_convertible_to_real_p (const_tree from_type, const_tree to_type) ...@@ -1324,14 +1324,11 @@ int_safely_convertible_to_real_p (const_tree from_type, const_tree to_type)
to TYPE. */ to TYPE. */
enum conversion_safety enum conversion_safety
unsafe_conversion_p (location_t loc, tree type, tree expr, tree result, unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign)
bool check_sign)
{ {
enum conversion_safety give_warning = SAFE_CONVERSION; /* is 0 or false */ enum conversion_safety give_warning = SAFE_CONVERSION; /* is 0 or false */
tree expr_type = TREE_TYPE (expr); tree expr_type = TREE_TYPE (expr);
loc = expansion_point_location_if_in_system_header (loc);
expr = fold_for_warn (expr); expr = fold_for_warn (expr);
if (TREE_CODE (expr) == REAL_CST || TREE_CODE (expr) == INTEGER_CST) if (TREE_CODE (expr) == REAL_CST || TREE_CODE (expr) == INTEGER_CST)
...@@ -1402,7 +1399,7 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, tree result, ...@@ -1402,7 +1399,7 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, tree result,
with different type of EXPR, but it is still safe, because when EXPR with different type of EXPR, but it is still safe, because when EXPR
is a constant, it's type is not used in text of generated warnings is a constant, it's type is not used in text of generated warnings
(otherwise they could sound misleading). */ (otherwise they could sound misleading). */
return unsafe_conversion_p (loc, type, TREE_REALPART (expr), result, return unsafe_conversion_p (type, TREE_REALPART (expr), result,
check_sign); check_sign);
/* Conversion from complex constant with non-zero imaginary part. */ /* Conversion from complex constant with non-zero imaginary part. */
else else
...@@ -1412,10 +1409,10 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, tree result, ...@@ -1412,10 +1409,10 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, tree result,
if (TREE_CODE (type) == COMPLEX_TYPE) if (TREE_CODE (type) == COMPLEX_TYPE)
{ {
enum conversion_safety re_safety = enum conversion_safety re_safety =
unsafe_conversion_p (loc, type, TREE_REALPART (expr), unsafe_conversion_p (type, TREE_REALPART (expr),
result, check_sign); result, check_sign);
enum conversion_safety im_safety = enum conversion_safety im_safety =
unsafe_conversion_p (loc, type, imag_part, result, check_sign); unsafe_conversion_p (type, imag_part, result, check_sign);
/* Merge the results into appropriate single warning. */ /* Merge the results into appropriate single warning. */
...@@ -8068,7 +8065,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1, ...@@ -8068,7 +8065,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1,
if (TREE_CODE (type0) == INTEGER_TYPE if (TREE_CODE (type0) == INTEGER_TYPE
&& TREE_CODE (TREE_TYPE (type1)) == INTEGER_TYPE) && TREE_CODE (TREE_TYPE (type1)) == INTEGER_TYPE)
{ {
if (unsafe_conversion_p (loc, TREE_TYPE (type1), op0, if (unsafe_conversion_p (TREE_TYPE (type1), op0,
NULL_TREE, false)) NULL_TREE, false))
{ {
if (complain) if (complain)
...@@ -8117,7 +8114,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1, ...@@ -8117,7 +8114,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1,
if (TREE_CODE (type0) == INTEGER_TYPE if (TREE_CODE (type0) == INTEGER_TYPE
&& TREE_CODE (TREE_TYPE (type1)) == INTEGER_TYPE) && TREE_CODE (TREE_TYPE (type1)) == INTEGER_TYPE)
{ {
if (unsafe_conversion_p (loc, TREE_TYPE (type1), op0, if (unsafe_conversion_p (TREE_TYPE (type1), op0,
NULL_TREE, false)) NULL_TREE, false))
{ {
if (complain) if (complain)
...@@ -8133,7 +8130,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1, ...@@ -8133,7 +8130,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1,
|| TREE_CODE (type0) == INTEGER_TYPE) || TREE_CODE (type0) == INTEGER_TYPE)
&& SCALAR_FLOAT_TYPE_P (TREE_TYPE (type1))) && SCALAR_FLOAT_TYPE_P (TREE_TYPE (type1)))
{ {
if (unsafe_conversion_p (loc, TREE_TYPE (type1), op0, if (unsafe_conversion_p (TREE_TYPE (type1), op0,
NULL_TREE, false)) NULL_TREE, false))
{ {
if (complain) if (complain)
......
...@@ -853,8 +853,7 @@ extern tree c_common_signed_type (tree); ...@@ -853,8 +853,7 @@ extern tree c_common_signed_type (tree);
extern tree c_common_signed_or_unsigned_type (int, tree); extern tree c_common_signed_or_unsigned_type (int, tree);
extern void c_common_init_ts (void); extern void c_common_init_ts (void);
extern tree c_build_bitfield_integer_type (unsigned HOST_WIDE_INT, int); extern tree c_build_bitfield_integer_type (unsigned HOST_WIDE_INT, int);
extern enum conversion_safety unsafe_conversion_p (location_t, tree, tree, tree, extern enum conversion_safety unsafe_conversion_p (tree, tree, tree, bool);
bool);
extern bool decl_with_nonnull_addr_p (const_tree); extern bool decl_with_nonnull_addr_p (const_tree);
extern tree c_fully_fold (tree, bool, bool *, bool = false); extern tree c_fully_fold (tree, bool, bool *, bool = false);
extern tree c_wrap_maybe_const (tree, bool); extern tree c_wrap_maybe_const (tree, bool);
......
...@@ -1202,7 +1202,7 @@ conversion_warning (location_t loc, tree type, tree expr, tree result) ...@@ -1202,7 +1202,7 @@ conversion_warning (location_t loc, tree type, tree expr, tree result)
case INTEGER_CST: case INTEGER_CST:
case COMPLEX_CST: case COMPLEX_CST:
{ {
conversion_kind = unsafe_conversion_p (loc, type, expr, result, true); conversion_kind = unsafe_conversion_p (type, expr, result, true);
int warnopt; int warnopt;
if (conversion_kind == UNSAFE_REAL) if (conversion_kind == UNSAFE_REAL)
warnopt = OPT_Wfloat_conversion; warnopt = OPT_Wfloat_conversion;
...@@ -1310,7 +1310,7 @@ conversion_warning (location_t loc, tree type, tree expr, tree result) ...@@ -1310,7 +1310,7 @@ conversion_warning (location_t loc, tree type, tree expr, tree result)
is_arith = true; is_arith = true;
gcc_fallthrough (); gcc_fallthrough ();
default: default:
conversion_kind = unsafe_conversion_p (loc, type, expr, result, true); conversion_kind = unsafe_conversion_p (type, expr, result, true);
{ {
int warnopt; int warnopt;
if (conversion_kind == UNSAFE_REAL) if (conversion_kind == UNSAFE_REAL)
......
...@@ -5170,14 +5170,14 @@ build_conditional_expr_1 (const op_location_t &loc, ...@@ -5170,14 +5170,14 @@ build_conditional_expr_1 (const op_location_t &loc,
but the warnings (like Wsign-conversion) have already been but the warnings (like Wsign-conversion) have already been
given by the scalar build_conditional_expr_1. We still check given by the scalar build_conditional_expr_1. We still check
unsafe_conversion_p to forbid truncating long long -> float. */ unsafe_conversion_p to forbid truncating long long -> float. */
if (unsafe_conversion_p (loc, stype, arg2, NULL_TREE, false)) if (unsafe_conversion_p (stype, arg2, NULL_TREE, false))
{ {
if (complain & tf_error) if (complain & tf_error)
error_at (loc, "conversion of scalar %qH to vector %qI " error_at (loc, "conversion of scalar %qH to vector %qI "
"involves truncation", arg2_type, vtype); "involves truncation", arg2_type, vtype);
return error_mark_node; return error_mark_node;
} }
if (unsafe_conversion_p (loc, stype, arg3, NULL_TREE, false)) if (unsafe_conversion_p (stype, arg3, NULL_TREE, false))
{ {
if (complain & tf_error) if (complain & tf_error)
error_at (loc, "conversion of scalar %qH to vector %qI " error_at (loc, "conversion of scalar %qH to vector %qI "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment