This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] xtensa message pluralization


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6e98b3428bdd0bf388c3c72eb205105926b15a64

commit 6e98b3428bdd0bf388c3c72eb205105926b15a64
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Nov 7 17:03:41 2017 +1030

    xtensa message pluralization
    
    	* config/tc-xtensa.c (finish_vinsn): Properly pluralize error message.

Diff:
---
 gas/ChangeLog          |  4 ++++
 gas/config/tc-xtensa.c | 18 ++++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 80e9ea7..c13f9b1 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2017-11-08  Alan Modra  <amodra@gmail.com>
+
+	* config/tc-xtensa.c (finish_vinsn): Properly pluralize error message.
+
 2017-11-07  Jim Wilson  <jimw@sifive.com>
 
 	* config/tc-riscv.c (append_insn): Call frag_wane and frag_new at
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index a73abd0..3fe85d2 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -6358,10 +6358,20 @@ finish_vinsn (vliw_insn *vinsn)
   if (vinsn->num_slots
       != xtensa_format_num_slots (xtensa_default_isa, vinsn->format))
     {
-      as_bad (_("format '%s' allows %d slots, but there are %d opcodes"),
-	      xtensa_format_name (xtensa_default_isa, vinsn->format),
-	      xtensa_format_num_slots (xtensa_default_isa, vinsn->format),
-	      vinsn->num_slots);
+      char *msg;
+      int slots = xtensa_format_num_slots (xtensa_default_isa, vinsn->format);
+
+      msg = concat (ngettext ("format '%s' allows %d slot, ",
+			      "format '%s' allows %d slots, ",
+			      slots),
+		    ngettext ("but there is %d opcode",
+			      "but there are %d opcodes",
+			      vinsn->num_slots),
+		    (const char *) 0);
+
+      as_bad (msg, xtensa_format_name (xtensa_default_isa, vinsn->format),
+	      slots, vinsn->num_slots);
+      free (msg);
       xg_clear_vinsn (vinsn);
       return;
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]