[gcc(refs/users/ppalka/heads/libstdcxx-constrained-algos)] c-family: Remove location parm from unsafe_conversion_p.
Patrick Palka
ppalka@gcc.gnu.org
Sat Jan 25 22:50:00 GMT 2020
https://gcc.gnu.org/g:d9637168812939d6c9df29ce747d8d4648b37cef
commit d9637168812939d6c9df29ce747d8d4648b37cef
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jan 22 14:12:55 2020 -0500
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.
Diff:
---
gcc/c-family/c-common.c | 17 +++++++----------
gcc/c-family/c-common.h | 3 +--
gcc/c-family/c-warn.c | 4 ++--
gcc/cp/call.c | 4 ++--
4 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 4a7f3a5..774e29b 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -1324,14 +1324,11 @@ int_safely_convertible_to_real_p (const_tree from_type, const_tree to_type)
to TYPE. */
enum conversion_safety
-unsafe_conversion_p (location_t loc, tree type, tree expr, tree result,
- bool check_sign)
+unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign)
{
enum conversion_safety give_warning = SAFE_CONVERSION; /* is 0 or false */
tree expr_type = TREE_TYPE (expr);
- loc = expansion_point_location_if_in_system_header (loc);
-
expr = fold_for_warn (expr);
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,
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
(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);
/* Conversion from complex constant with non-zero imaginary part. */
else
@@ -1412,10 +1409,10 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, tree result,
if (TREE_CODE (type) == COMPLEX_TYPE)
{
enum conversion_safety re_safety =
- unsafe_conversion_p (loc, type, TREE_REALPART (expr),
+ unsafe_conversion_p (type, TREE_REALPART (expr),
result, check_sign);
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. */
@@ -8068,7 +8065,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1,
if (TREE_CODE (type0) == 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))
{
if (complain)
@@ -8117,7 +8114,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1,
if (TREE_CODE (type0) == 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))
{
if (complain)
@@ -8133,7 +8130,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1,
|| TREE_CODE (type0) == INTEGER_TYPE)
&& 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))
{
if (complain)
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index fb0d53b..3e26ca0 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -853,8 +853,7 @@ extern tree c_common_signed_type (tree);
extern tree c_common_signed_or_unsigned_type (int, tree);
extern void c_common_init_ts (void);
extern tree c_build_bitfield_integer_type (unsigned HOST_WIDE_INT, int);
-extern enum conversion_safety unsafe_conversion_p (location_t, tree, tree, tree,
- bool);
+extern enum conversion_safety unsafe_conversion_p (tree, tree, tree, bool);
extern bool decl_with_nonnull_addr_p (const_tree);
extern tree c_fully_fold (tree, bool, bool *, bool = false);
extern tree c_wrap_maybe_const (tree, bool);
diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c
index d8f0ad6..4df4893 100644
--- a/gcc/c-family/c-warn.c
+++ b/gcc/c-family/c-warn.c
@@ -1202,7 +1202,7 @@ conversion_warning (location_t loc, tree type, tree expr, tree result)
case INTEGER_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;
if (conversion_kind == UNSAFE_REAL)
warnopt = OPT_Wfloat_conversion;
@@ -1310,7 +1310,7 @@ conversion_warning (location_t loc, tree type, tree expr, tree result)
is_arith = true;
gcc_fallthrough ();
default:
- conversion_kind = unsafe_conversion_p (loc, type, expr, result, true);
+ conversion_kind = unsafe_conversion_p (type, expr, result, true);
{
int warnopt;
if (conversion_kind == UNSAFE_REAL)
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index aacd961..009cb85 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -5170,14 +5170,14 @@ build_conditional_expr_1 (const op_location_t &loc,
but the warnings (like Wsign-conversion) have already been
given by the scalar build_conditional_expr_1. We still check
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)
error_at (loc, "conversion of scalar %qH to vector %qI "
"involves truncation", arg2_type, vtype);
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)
error_at (loc, "conversion of scalar %qH to vector %qI "
More information about the Gcc-cvs
mailing list