]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas and ld pluralization fixes
authorAlan Modra <amodra@gmail.com>
Mon, 6 Nov 2017 09:14:02 +0000 (19:44 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 7 Nov 2017 06:30:37 +0000 (17:00 +1030)
gas/
* as.c (main): Properly pluralize messages.
* frags.c (frag_grow): Likewise.
* read.c (emit_expr_with_reloc, emit_expr_fix): Likewise.
(parse_bitfield_cons): Likewise.
* write.c (fixup_segment, compress_debug, write_contents): Likewise.
(relax_segment): Likewise.
* config/tc-arm.c (s_arm_elf_cons): Likewise.
* config/tc-cr16.c (l_cons): Likewise.
* config/tc-i370.c (i370_elf_cons): Likewise.
* config/tc-m68k.c (m68k_elf_cons): Likewise.
* config/tc-msp430.c (msp430_operands): Likewise.
* config/tc-s390.c (s390_elf_cons, s390_literals): Likewise.
* config/tc-mcore.c (md_apply_fix): Likewise.
* config/tc-tic54x.c (md_assemble): Likewise.
* config/tc-xtensa.c (xtensa_elf_cons): Likewise.
(xg_expand_assembly_insn): Likewise.
* config/xtensa-relax.c (build_transition): Likewise.
ld/
* ldlang.c (lang_size_sections_1): Properly pluralize messages.
(lang_check_section_addresses): Likewise.

17 files changed:
gas/ChangeLog
gas/as.c
gas/config/tc-arm.c
gas/config/tc-cr16.c
gas/config/tc-i370.c
gas/config/tc-m68k.c
gas/config/tc-mcore.c
gas/config/tc-msp430.c
gas/config/tc-s390.c
gas/config/tc-tic54x.c
gas/config/tc-xtensa.c
gas/config/xtensa-relax.c
gas/frags.c
gas/read.c
gas/write.c
ld/ChangeLog
ld/ldlang.c

index 7ad6938d921bef746699995dd6e05e08954aa428..ee42ab52a44641c9018e9d9871f378e9ecfb9535 100644 (file)
@@ -1,3 +1,23 @@
+2017-11-07  Alan Modra  <amodra@gmail.com>
+
+       * as.c (main): Properly pluralize messages.
+       * frags.c (frag_grow): Likewise.
+       * read.c (emit_expr_with_reloc, emit_expr_fix): Likewise.
+       (parse_bitfield_cons): Likewise.
+       * write.c (fixup_segment, compress_debug, write_contents): Likewise.
+       (relax_segment): Likewise.
+       * config/tc-arm.c (s_arm_elf_cons): Likewise.
+       * config/tc-cr16.c (l_cons): Likewise.
+       * config/tc-i370.c (i370_elf_cons): Likewise.
+       * config/tc-m68k.c (m68k_elf_cons): Likewise.
+       * config/tc-msp430.c (msp430_operands): Likewise.
+       * config/tc-s390.c (s390_elf_cons, s390_literals): Likewise.
+       * config/tc-mcore.c (md_apply_fix): Likewise.
+       * config/tc-tic54x.c (md_assemble): Likewise.
+       * config/tc-xtensa.c (xtensa_elf_cons): Likewise.
+       (xg_expand_assembly_insn): Likewise.
+       * config/xtensa-relax.c (build_transition): Likewise.
+
 2017-11-07  Alan Modra  <amodra@gmail.com>
 
        * asintl.h (textdomain, bindtextdomain): Use safer "do nothing".
index 47175591a083e944cff93ebff99623899ca7a7a9..31e62805af611dfed306cc90349ccdd4973bf709 100644 (file)
--- a/gas/as.c
+++ b/gas/as.c
@@ -1316,15 +1316,10 @@ main (int argc, char ** argv)
       n_warns = had_warnings ();
       n_errs = had_errors ();
 
-      if (n_warns == 1)
-       sprintf (warn_msg, _("%d warning"), n_warns);
-      else
-       sprintf (warn_msg, _("%d warnings"), n_warns);
-      if (n_errs == 1)
-       sprintf (err_msg, _("%d error"), n_errs);
-      else
-       sprintf (err_msg, _("%d errors"), n_errs);
-
+      sprintf (warn_msg,
+              ngettext ("%d warning", "%d warnings", n_warns), n_warns);
+      sprintf (err_msg,
+              ngettext ("%d error", "%d errors", n_errs), n_errs);
       if (flag_fatal_warnings && n_warns != 0)
        {
          if (n_errs == 0)
index f52cf7fac27f6e3fc43e36863438aec3f7e3bc2a..86d6ea55fbab37d5ad1125bc08a77f181a6d1c25 100644 (file)
@@ -3552,7 +3552,9 @@ s_arm_elf_cons (int nbytes)
                }
 
              if (size > nbytes)
-               as_bad (_("%s relocations do not fit in %d bytes"),
+               as_bad (ngettext ("%s relocations do not fit in %d byte",
+                                 "%s relocations do not fit in %d bytes",
+                                 nbytes),
                        howto->name, nbytes);
              else
                {
index 4205a77fda48a8db2a0a73aafd424409b137b7db..fce52c1a23c77e3e087d4f2be72e082d443683fc 100644 (file)
@@ -178,7 +178,12 @@ l_cons (int nbytes)
               if ((width = exp.X_add_number) >
                   (unsigned int)(BITS_PER_CHAR * nbytes))
                 {
-                  as_warn (_("field width %lu too big to fit in %d bytes: truncated to %d bits"), width, nbytes, (BITS_PER_CHAR * nbytes));
+                 as_warn (ngettext ("field width %lu too big to fit in %d"
+                                    " byte: truncated to %d bits",
+                                    "field width %lu too big to fit in %d"
+                                    " bytes: truncated to %d bits",
+                                    nbytes),
+                          width, nbytes, (BITS_PER_CHAR * nbytes));
                   width = BITS_PER_CHAR * nbytes;
                 }                   /* Too big.  */
 
index 995aa4c79131f756faef21046c3d08d9ffe4c475..a6838b1127d837aee6338d4db8d3dc0ace7a36bb 100644 (file)
@@ -680,7 +680,9 @@ i370_elf_cons (int nbytes)   /* 1=.byte, 2=.word, 4=.long.  */
           int size = bfd_get_reloc_size (reloc_howto);
 
           if (size > nbytes)
-            as_bad (_("%s relocations do not fit in %d bytes\n"),
+           as_bad (ngettext ("%s relocations do not fit in %u byte",
+                             "%s relocations do not fit in %u bytes",
+                             nbytes),
                    reloc_howto->name, nbytes);
           else
             {
index 04e57f46e8e02e1d2034f65faa38a492633f58f1..cba07e24b21222ca03debea45c3018bf3a4ef9be 100644 (file)
@@ -8068,7 +8068,9 @@ m68k_elf_cons (int nbytes /* 4=.long */)
 
          if (size > nbytes)
            {
-             as_bad (_("%s relocations do not fit in %d bytes\n"),
+             as_bad (ngettext ("%s relocations do not fit in %u byte",
+                               "%s relocations do not fit in %u bytes",
+                               nbytes),
                      reloc_howto->name, nbytes);
            }
          else
index 2ffb2413d6b0613266c8ff7c199fd7bce003e787..21fcc695fe4d1a36268d370bbad661540460a37f 100644 (file)
@@ -1947,7 +1947,10 @@ md_apply_fix (fixS *   fixP,
     case BFD_RELOC_MCORE_PCREL_IMM11BY2:
       if ((val & 1) != 0)
        as_bad_where (file, fixP->fx_line,
-                     _("odd distance branch (0x%lx bytes)"), (long) val);
+                     ngettext ("odd distance branch (0x%lx byte)",
+                               "odd distance branch (0x%lx bytes)",
+                               (long) val),
+                     (long) val);
       val /= 2;
       if (((val & ~0x3ff) != 0) && ((val | 0x3ff) != -1))
        as_bad_where (file, fixP->fx_line,
index 6f3acdf727532d8f7d0d8c26843ddb3127e5a2f8..a56e7f2708e7a35a58ab7536037920b7f2d0e332 100644 (file)
@@ -2601,7 +2601,9 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
       && opcode->insn_opnumb
       && (!*line || *line == '\n'))
     {
-      as_bad (_("instruction %s requires %d operand(s)"),
+      as_bad (ngettext ("instruction %s requires %d operand",
+                       "instruction %s requires %d operands",
+                       opcode->insn_opnumb),
              opcode->name, opcode->insn_opnumb);
       return 0;
     }
index 84b2e270e96bdd7b88572af8b4b2e9b410a0d78e..48a2f9b6d1e51e6f0ea56df773ce2039a3889b03 100644 (file)
@@ -1206,7 +1206,9 @@ s390_elf_cons (int nbytes /* 1=.byte, 2=.word, 4=.long */)
            {
              size = bfd_get_reloc_size (reloc_howto);
              if (size > nbytes)
-               as_bad (_("%s relocations do not fit in %d bytes"),
+               as_bad (ngettext ("%s relocations do not fit in %d byte",
+                                 "%s relocations do not fit in %d bytes",
+                                 nbytes),
                        reloc_howto->name, nbytes);
              where = frag_more (nbytes);
              md_number_to_chars (where, 0, size);
@@ -1860,7 +1862,9 @@ s390_literals (int ignore ATTRIBUTE_UNUSED)
          char *where;
 
          if (size > lpe->nbytes)
-           as_bad (_("%s relocations do not fit in %d bytes"),
+           as_bad (ngettext ("%s relocations do not fit in %d byte",
+                             "%s relocations do not fit in %d bytes",
+                             lpe->nbytes),
                    reloc_howto->name, lpe->nbytes);
          where = frag_more (lpe->nbytes);
          md_number_to_chars (where, 0, size);
index f7dc0f53cc01ad44747ec8860012b173be77d01c..ea6c57f08221353cfeb4ddbdcf1306d4c085279a 100644 (file)
@@ -4843,8 +4843,11 @@ md_assemble (char *line)
            {
              if (words > delay_slots)
                {
-                 as_bad (_("Instruction does not fit in available delay "
-                           "slots (%d-word insn, %d slots left)"),
+                 as_bad (ngettext ("Instruction does not fit in available "
+                                   "delay slots (%d-word insn, %d slot left)",
+                                   "Instruction does not fit in available "
+                                   "delay slots (%d-word insn, %d slots left)",
+                                   delay_slots),
                          words, delay_slots);
                  delay_slots = 0;
                  return;
@@ -4915,9 +4918,13 @@ md_assemble (char *line)
        {
          if (words > delay_slots)
            {
-             as_warn (_("Instruction does not fit in available delay "
-                        "slots (%d-word insn, %d slots left). "
-                        "Resulting behavior is undefined."),
+             as_warn (ngettext ("Instruction does not fit in available "
+                                "delay slots (%d-word insn, %d slot left). "
+                                "Resulting behavior is undefined.",
+                                "Instruction does not fit in available "
+                                "delay slots (%d-word insn, %d slots left). "
+                                "Resulting behavior is undefined.",
+                                delay_slots),
                       words, delay_slots);
              delay_slots = 0;
              return;
index 836b5505246c5a3ce7f0de5b9c3c337794eef6ee..a73abd08ed540b04613d2ac0871aca8500c89081 100644 (file)
@@ -1660,7 +1660,9 @@ xtensa_elf_cons (int nbytes)
            as_bad (_("opcode-specific %s relocation used outside "
                      "an instruction"), reloc_howto->name);
          else if (nbytes != (int) bfd_get_reloc_size (reloc_howto))
-           as_bad (_("%s relocations do not fit in %d bytes"),
+           as_bad (ngettext ("%s relocations do not fit in %d byte",
+                             "%s relocations do not fit in %d bytes",
+                             nbytes),
                    reloc_howto->name, nbytes);
          else if (reloc == BFD_RELOC_XTENSA_TLS_FUNC
                   || reloc == BFD_RELOC_XTENSA_TLS_ARG
@@ -4014,14 +4016,18 @@ xg_expand_assembly_insn (IStack *istack, TInsn *orig_insn)
                                          orig_insn->opcode);
   if (orig_insn->ntok < noperands)
     {
-      as_bad (_("found %d operands for '%s':  Expected %d"),
+      as_bad (ngettext ("found %d operand for '%s':  Expected %d",
+                       "found %d operands for '%s':  Expected %d",
+                       orig_insn->ntok),
              orig_insn->ntok,
              xtensa_opcode_name (xtensa_default_isa, orig_insn->opcode),
              noperands);
       return TRUE;
     }
   if (orig_insn->ntok > noperands)
-    as_warn (_("found too many (%d) operands for '%s':  Expected %d"),
+    as_warn (ngettext ("found %d operand for '%s':  Expected %d",
+                      "found %d operands for '%s':  Expected %d",
+                      orig_insn->ntok),
             orig_insn->ntok,
             xtensa_opcode_name (xtensa_default_isa, orig_insn->opcode),
             noperands);
index 82f1d034b70e34deaef190c3773a3851b0e622a6..97939e195d9dfdf349daebcddb727e0153297b44 100644 (file)
@@ -1764,7 +1764,9 @@ build_transition (insn_pattern *initial_insn,
          /* Check for the right number of ops.  */
          if (xtensa_opcode_num_operands (isa, bi->opcode)
              != (int) operand_count)
-           as_fatal (_("opcode '%s': replacement does not have %d ops"),
+           as_fatal (ngettext ("opcode '%s': replacement does not have %d op",
+                               "opcode '%s': replacement does not have %d ops",
+                               xtensa_opcode_num_operands (isa, bi->opcode)),
                      opcode_name,
                      xtensa_opcode_num_operands (isa, bi->opcode));
        }
index 7997422ce04a4202a1e44cbf33c130a391309462..c502017631c4d9c9848a0ebe288ada7e6e9db77b 100644 (file)
@@ -112,7 +112,10 @@ frag_grow (size_t nchars)
 
       /* Check for possible overflow.  */
       if (newc < nchars)
-        as_fatal (_("can't extend frag %lu chars"), (unsigned long) nchars);
+       as_fatal (ngettext ("can't extend frag %lu char",
+                           "can't extend frag %lu chars",
+                           (unsigned long) nchars),
+                 (unsigned long) nchars);
 
       /* Force to allocate at least NEWC bytes, but not less than the
          default.  */
index 9f2909f797976955a89dd9dd8f36742e83daff26..17e816275644292a158a85bb0cc5a6dda4233239 100644 (file)
@@ -4489,7 +4489,10 @@ emit_expr_with_reloc (expressionS *exp,
            }
 
          if (i < exp->X_add_number)
-           as_warn (_("bignum truncated to %d bytes"), nbytes);
+           as_warn (ngettext ("bignum truncated to %d byte",
+                              "bignum truncated to %d bytes",
+                              nbytes),
+                    nbytes);
          size = nbytes;
        }
 
@@ -4565,7 +4568,9 @@ emit_expr_fix (expressionS *exp, unsigned int nbytes, fragS *frag, char *p,
 
       if (size > nbytes)
        {
-         as_bad (_("%s relocations do not fit in %u bytes\n"),
+         as_bad (ngettext ("%s relocations do not fit in %u byte",
+                           "%s relocations do not fit in %u bytes",
+                           nbytes),
                  reloc_howto->name, nbytes);
          return;
        }
@@ -4674,7 +4679,11 @@ parse_bitfield_cons (expressionS *exp, unsigned int nbytes)
 
          if ((width = exp->X_add_number) > (BITS_PER_CHAR * nbytes))
            {
-             as_warn (_("field width %lu too big to fit in %d bytes: truncated to %d bits"),
+             as_warn (ngettext ("field width %lu too big to fit in %d byte:"
+                                " truncated to %d bits",
+                                "field width %lu too big to fit in %d bytes:"
+                                " truncated to %d bits",
+                                nbytes),
                       width, nbytes, (BITS_PER_CHAR * nbytes));
              width = BITS_PER_CHAR * nbytes;
            }                   /* Too big.  */
index df88905013b9d12ab82000a5d20b137dd7cc4362..690852c6ba270755cc4a6006b0d9626419350632 100644 (file)
@@ -1106,7 +1106,11 @@ fixup_segment (fixS *fixP, segT this_segment)
                  else
                    sprintf (buf2, "%ld", (long) add_number);
                  as_bad_where (fixP->fx_file, fixP->fx_line,
-                               _("value of %s too large for field of %d bytes at %s"),
+                               ngettext ("value of %s too large for field "
+                                         "of %d byte at %s",
+                                         "value of %s too large for field "
+                                         "of %d bytes at %s",
+                                         fixP->fx_size),
                                buf2, fixP->fx_size, buf);
                } /* Generic error checking.  */
            }
@@ -1458,7 +1462,10 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED)
   if (obstack_room (ob) < header_size)
     first_newf = frag_alloc (ob);
   if (obstack_room (ob) < header_size)
-    as_fatal (_("can't extend frag %u chars"), header_size);
+    as_fatal (ngettext ("can't extend frag %lu char",
+                       "can't extend frag %lu chars",
+                       (unsigned long) header_size),
+             (unsigned long) header_size);
   last_newf = first_newf;
   obstack_blank_fast (ob, header_size);
   last_newf->fr_type = rs_fill;
@@ -1593,9 +1600,13 @@ write_contents (bfd *abfd ATTRIBUTE_UNUSED,
                                        f->fr_literal, (file_ptr) offset,
                                        (bfd_size_type) f->fr_fix);
          if (!x)
-           as_fatal (_("can't write %ld bytes to section %s of %s because: '%s'"),
-                     (long) f->fr_fix, sec->name,
-                     stdoutput->filename,
+           as_fatal (ngettext ("can't write %ld byte "
+                               "to section %s of %s: '%s'",
+                               "can't write %ld bytes "
+                               "to section %s of %s: '%s'",
+                               (long) f->fr_fix),
+                     (long) f->fr_fix,
+                     sec->name, stdoutput->filename,
                      bfd_errmsg (bfd_get_error ()));
          offset += f->fr_fix;
        }
@@ -1616,9 +1627,13 @@ write_contents (bfd *abfd ATTRIBUTE_UNUSED,
                                                (file_ptr) offset,
                                                (bfd_size_type) fill_size);
                  if (!x)
-                   as_fatal (_("can't fill %ld bytes in section %s of %s because '%s'"),
-                             (long) fill_size, sec->name,
-                             stdoutput->filename,
+                   as_fatal (ngettext ("can't fill %ld byte "
+                                       "in section %s of %s: '%s'",
+                                       "can't fill %ld bytes "
+                                       "in section %s of %s: '%s'",
+                                       (long) fill_size),
+                             (long) fill_size,
+                             sec->name, stdoutput->filename,
                              bfd_errmsg (bfd_get_error ()));
                  offset += fill_size;
                }
@@ -1648,9 +1663,13 @@ write_contents (bfd *abfd ATTRIBUTE_UNUSED,
                    (stdoutput, sec, buf, (file_ptr) offset,
                     (bfd_size_type) n_per_buf * fill_size);
                  if (!x)
-                   as_fatal (_("cannot fill %ld bytes in section %s of %s because: '%s'"),
-                             (long)(n_per_buf * fill_size), sec->name,
-                             stdoutput->filename,
+                   as_fatal (ngettext ("can't fill %ld byte "
+                                       "in section %s of %s: '%s'",
+                                       "can't fill %ld bytes "
+                                       "in section %s of %s: '%s'",
+                                       (long) (n_per_buf * fill_size)),
+                             (long) (n_per_buf * fill_size),
+                             sec->name, stdoutput->filename,
                              bfd_errmsg (bfd_get_error ()));
                  offset += n_per_buf * fill_size;
                }
@@ -2422,7 +2441,11 @@ relax_segment (struct frag *segment_frag_root, segT segment, int pass)
            if (offset % fragP->fr_var != 0)
              {
                as_bad_where (fragP->fr_file, fragP->fr_line,
-                             _("alignment padding (%lu bytes) not a multiple of %ld"),
+                             ngettext ("alignment padding (%lu byte) "
+                                       "not a multiple of %ld",
+                                       "alignment padding (%lu bytes) "
+                                       "not a multiple of %ld",
+                                       (unsigned long) offset),
                              (unsigned long) offset, (long) fragP->fr_var);
                offset -= (offset % fragP->fr_var);
              }
index 48d771fee88e4ce09be418b96cb5df89404315f2..a76dde70f9b72b125060d8e3bc1d7aef4737abac 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-07  Alan Modra  <amodra@gmail.com>
+
+       * ldlang.c (lang_size_sections_1): Properly pluralize messages.
+       (lang_check_section_addresses): Likewise.
+
 2017-11-07  Alan Modra  <amodra@gmail.com>
 
        * ld.h (textdomain, bindtextdomain): Use safer "do nothing".
index 3ed707865ed6c26eecadb01a06c316ae7d216e50..b89c4e6daadd10291b55036cf7a024b8a3a87e7c 100644 (file)
@@ -4929,8 +4929,13 @@ lang_check_section_addresses (void)
      a bfd_vma quantity in decimal.  */
   for (m = lang_memory_region_list; m; m = m->next)
     if (m->had_full_message)
-      einfo (_("%X%P: region `%s' overflowed by %ld bytes\n"),
-            m->name_list.name, (long)(m->current - (m->origin + m->length)));
+      {
+       unsigned long over = m->current - (m->origin + m->length);
+       einfo (ngettext ("%X%P: region `%s' overflowed by %lu byte\n",
+                        "%X%P: region `%s' overflowed by %lu bytes\n",
+                        over),
+              m->name_list.name, over);
+      }
 }
 
 /* Make sure the new address is within the region.  We explicitly permit the
@@ -5130,8 +5135,11 @@ lang_size_sections_1
                        && (config.warn_section_align
                            || os->addr_tree != NULL)
                        && expld.phase != lang_mark_phase_enum)
-                     einfo (_("%P: warning: changing start of section"
-                              " %s by %lu bytes\n"),
+                     einfo (ngettext ("%P: warning: changing start of "
+                                      "section %s by %lu byte\n",
+                                      "%P: warning: changing start of "
+                                      "section %s by %lu bytes\n",
+                                      (unsigned long) dotdelta),
                             os->name, (unsigned long) dotdelta);
                  }