Use error_n rather than error_at for “%d vectors”, so that
translators can pick different translations based on the
number (2 vs more than 2, etc.)

Tested on aarch64-linux-gnu & pushed.

Richard


gcc/
        PR target/104897
        * config/aarch64/aarch64-sve-builtins.cc
        (function_resolver::infer_vector_or_tuple_type): Use error_n
        for "%d vectors" messages.
---
 gcc/config/aarch64/aarch64-sve-builtins.cc | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc 
b/gcc/config/aarch64/aarch64-sve-builtins.cc
index 3381726027d..5d1348afa88 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
@@ -1352,13 +1352,17 @@ function_resolver::infer_vector_or_tuple_type (unsigned 
int argno,
                        " expects a single SVE vector rather than a tuple",
                        actual, argno + 1, fndecl);
            else if (size_i == 0 && type_i != VECTOR_TYPE_svbool_t)
-             error_at (location, "passing single vector %qT to argument %d"
-                       " of %qE, which expects a tuple of %d vectors",
-                       actual, argno + 1, fndecl, num_vectors);
+             /* num_vectors is always != 1, so the singular isn't needed.  */
+             error_n (location, num_vectors, "%qT%d%qE%d",
+                      "passing single vector %qT to argument %d"
+                      " of %qE, which expects a tuple of %d vectors",
+                      actual, argno + 1, fndecl, num_vectors);
            else
-             error_at (location, "passing %qT to argument %d of %qE, which"
-                       " expects a tuple of %d vectors", actual, argno + 1,
-                       fndecl, num_vectors);
+             /* num_vectors is always != 1, so the singular isn't needed.  */
+             error_n (location, num_vectors, "%qT%d%qE%d",
+                      "passing %qT to argument %d of %qE, which"
+                      " expects a tuple of %d vectors", actual, argno + 1,
+                      fndecl, num_vectors);
            return NUM_TYPE_SUFFIXES;
          }
       }
-- 
2.25.1

Reply via email to