c-family: Remove location parm from unsafe_conversion_p.
authorJason Merrill <jason@redhat.com>
Wed, 22 Jan 2020 19:12:55 +0000 (14:12 -0500)
committerJason Merrill <jason@redhat.com>
Wed, 22 Jan 2020 22:05:42 +0000 (17:05 -0500)
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.

gcc/c-family/c-common.c
gcc/c-family/c-common.h
gcc/c-family/c-warn.c
gcc/cp/call.c

index 4a7f3a52335fa4c8e4853a0557f343d6dac85b22..774e29be1041a08743a166308bcb0047b031af05 100644 (file)
@@ -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)
index fb0d53b079ebb4c2db6e366d180ac722c0f0e968..3e26ca034ca36fc673e285faa72b83fdc2bfacd9 100644 (file)
@@ -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);
index d8f0ad654fe8c687d15c410805e769dbe32798ff..4df4893ca02ef08f7a9c0acd63582d84398a7c8c 100644 (file)
@@ -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)
index aacd961faa17ad7e95a46b11d5c8f86a6b740d6b..009cb85ad60db76fa1c2b50682e48e4d7414b5f9 100644 (file)
@@ -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 "