This patch removes the uses of %K from error() calls in the aarch64
and arm back ends.  I tested this change only by building a cross-
compiler but I can't easily run the tests so I'd appreciate some help
validating it.  The fallout from the change should be limited to changes
to error messages so in the worst case it could be addressed after
committing the patch.
gcc/ChangeLog:

	* config/aarch64/aarch64-builtins.c (aarch64_simd_expand_builtin):
	Remove %K and use error_at.
	(aarch64_expand_fcmla_builtin): Same.
	(aarch64_expand_builtin_tme): Same.
	(aarch64_expand_builtin_memtag): Same.
	* config/arm/arm-builtins.c (arm_expand_acle_builtin): Same.
	(arm_expand_builtin): Same.
	* config/arm/arm.c (bounds_check): Same.

diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c
index 3cab3ec992c..9ed4b72d005 100644
--- a/gcc/config/aarch64/aarch64-builtins.c
+++ b/gcc/config/aarch64/aarch64-builtins.c
@@ -1598,8 +1598,9 @@ constant_arg:
 	      if (!(*insn_data[icode].operand[opc].predicate)
 		  (op[opc], mode))
 	      {
-		error ("%Kargument %d must be a constant immediate",
-		       exp, opc + 1 - have_retval);
+		error_at (EXPR_LOCATION (exp),
+			  "argument %d must be a constant immediate",
+			  opc + 1 - have_retval);
 		return const0_rtx;
 	      }
 	      break;
@@ -1669,10 +1670,13 @@ aarch64_simd_expand_builtin (int fcode, tree exp, rtx target)
 				       / UINTVAL (elementsize),
 				      exp);
           else
-	    error ("%Klane index must be a constant immediate", exp);
+	    error_at (EXPR_LOCATION (exp),
+		      "lane index must be a constant immediate");
 	}
       else
-	error ("%Ktotal size and element size must be a non-zero constant immediate", exp);
+	error_at (EXPR_LOCATION (exp),
+		  "total size and element size must be a non-zero "
+		  "constant immediate");
       /* Don't generate any RTL.  */
       return const0_rtx;
     }
@@ -1828,7 +1832,8 @@ aarch64_expand_fcmla_builtin (tree exp, rtx target, int fcode)
   /* Validate that the lane index is a constant.  */
   if (!CONST_INT_P (lane_idx))
     {
-      error ("%Kargument %d must be a constant immediate", exp, 4);
+      error_at (EXPR_LOCATION (exp),
+		"argument %d must be a constant immediate", 4);
       return const0_rtx;
     }
 
@@ -1917,7 +1922,8 @@ aarch64_expand_builtin_tme (int fcode, tree exp, rtx target)
 	  emit_insn (GEN_FCN (CODE_FOR_tcancel) (op0));
 	else
 	  {
-	    error ("%Kargument must be a 16-bit constant immediate", exp);
+	    error_at (EXPR_LOCATION (exp),
+		      "argument must be a 16-bit constant immediate");
 	    return const0_rtx;
 	  }
       }
@@ -2006,8 +2012,9 @@ aarch64_expand_builtin_memtag (int fcode, tree exp, rtx target)
 		  pat = GEN_FCN (icode) (target, op0, const0_rtx, op1);
 		  break;
 		}
-	      error ("%Kargument %d must be a constant immediate "
-		     "in range [0,15]", exp, 2);
+	      error_at (EXPR_LOCATION (exp),
+			"argument %d must be a constant immediate "
+			"in range [0,15]", 2);
 	      return const0_rtx;
 	    }
 	  else
diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c
index fa0fb0b16ab..3a9ff8f26b8 100644
--- a/gcc/config/arm/arm-builtins.c
+++ b/gcc/config/arm/arm-builtins.c
@@ -3092,26 +3092,30 @@ constant_arg:
 			  unsigned int cp_bit = (CONST_INT_P (op[argc])
 						 ? UINTVAL (op[argc]) : -1);
 			  if (IN_RANGE (cp_bit, 0, ARM_CDE_CONST_COPROC))
-			    error ("%Kcoprocessor %d is not enabled "
-				   "with +cdecp%d", exp, cp_bit, cp_bit);
+			    error_at (EXPR_LOCATION (exp),
+				      "coprocessor %d is not enabled "
+				      "with +cdecp%d", cp_bit, cp_bit);
 			  else
-			    error ("%Kcoproc must be a constant immediate in "
-				   "range [0-%d] enabled with +cdecp<N>", exp,
-				   ARM_CDE_CONST_COPROC);
+			    error_at (EXPR_LOCATION (exp),
+				      "coproc must be a constant immediate in "
+				      "range [0-%d] enabled with +cdecp<N>",
+				      ARM_CDE_CONST_COPROC);
 			}
 		      else
 			/* Here we mention the builtin name to follow the same
 			   format that the C/C++ frontends use for referencing
 			   a given argument index.  */
-			error ("%Kargument %d to %qE must be a constant immediate "
-			       "in range [0-%d]", exp, argc + 1,
+			error_at (EXPR_LOCATION (exp),
+				  "argument %d to %qE must be a constant "
+				  "immediate in range [0-%d]", argc + 1,
 			       arm_builtin_decls[fcode],
 			       cde_builtin_data[fcode -
 			       ARM_BUILTIN_CDE_PATTERN_START].imm_max);
 		    }
 		  else
-		    error ("%Kargument %d must be a constant immediate",
-			   exp, argc + 1);
+		    error_at (EXPR_LOCATION (exp),
+			      "argument %d must be a constant immediate",
+			      argc + 1);
 		  /* We have failed to expand the pattern, and are safely
 		     in to invalid code.  But the mid-end will still try to
 		     build an assignment for this node while it expands,
@@ -3328,11 +3332,13 @@ arm_expand_acle_builtin (int fcode, tree exp, rtx target)
       if (CONST_INT_P (sat_imm))
 	{
 	  if (!IN_RANGE (sat_imm, min_sat, max_sat))
-	    error ("%Ksaturation bit range must be in the range [%wd, %wd]",
-		   exp, UINTVAL (min_sat), UINTVAL (max_sat));
+	    error_at (EXPR_LOCATION (exp),
+		      "saturation bit range must be in the range [%wd, %wd]",
+		      UINTVAL (min_sat), UINTVAL (max_sat));
 	}
       else
-	error ("%Ksaturation bit range must be a constant immediate", exp);
+	error_at (EXPR_LOCATION (exp),
+		  "saturation bit range must be a constant immediate");
       /* Don't generate any RTL.  */
       return const0_rtx;
     }
@@ -3455,7 +3461,8 @@ arm_expand_builtin (tree exp,
       if (CONST_INT_P (lane_idx))
 	neon_lane_bounds (lane_idx, 0, TREE_INT_CST_LOW (nlanes), exp);
       else
-	error ("%Klane index must be a constant immediate", exp);
+	error_at (EXPR_LOCATION (exp),
+		  "lane index must be a constant immediate");
       /* Don't generate any RTL.  */
       return const0_rtx;
     }
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 7b37e1b602c..7cdc824730c 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -13242,13 +13242,8 @@ bounds_check (rtx operand, HOST_WIDE_INT low, HOST_WIDE_INT high,
   lane = INTVAL (operand);
 
   if (lane < low || lane >= high)
-    {
-      if (exp)
-	error ("%K%s %wd out of range %wd - %wd",
-	       exp, desc, lane, low, high - 1);
-      else
-	error ("%s %wd out of range %wd - %wd", desc, lane, low, high - 1);
-    }
+    error_at (EXPR_LOCATION (exp),
+	      "%s %wd out of range %wd - %wd", desc, lane, low, high - 1);
 }
 
 /* Bounds-check lanes.  */

Reply via email to