This is the mail archive of the binutils@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]

xtensa message pluralization


I'm not too certain whether this is needed, ie. whether any of the slot
and opcode counts can be one.  Please review.

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

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 207d111..566a18e 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,9 @@
 2017-11-07  Alan Modra  <amodra@gmail.com>
 
+	* config/tc-xtensa.c (finish_vinsn): Properly pluralize error message.
+
+2017-11-07  Alan Modra  <amodra@gmail.com>
+
 	* read.c (assemble_one, s_bundle_unlock): Formatting.
 	Consistently add comma and "bytes" to error message.
 	* testsuite/gas/i386/bundle-bad.l: Adjust to suit.
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;
     }

-- 
Alan Modra
Australia Development Lab, IBM


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