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] opcodes error messages


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

commit a6743a5420aa02a0550b0f7be004f6c06e90ce21
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Mar 2 08:23:50 2018 +1030

    opcodes error messages
    
    Another patch aimed at making binutils comply with the GNU coding
    standard.  The generated files require
    https://sourceware.org/ml/cgen/2018-q1/msg00004.html
    
    cpu/
    	* frv.opc: Include opintl.h.
    	(add_next_to_vliw): Use opcodes_error_handler to print error.
    	Standardize error message.
    	(fr500_check_insn_major_constraints, frv_vliw_add_insn): Likewise.
    opcodes/
    	* sysdep.h (opcodes_error_handler): Define.
    	(_bfd_error_handler): Declare.
    	* Makefile.am: Remove stray #.
    	* opc2c.c (main): Remove bogus -l arg handling.  Print "DO NOT
    	EDIT" comment.
    	* aarch64-dis.c, * arc-dis.c, * arm-dis.c, * avr-dis.c,
    	* d30v-dis.c, * h8300-dis.c, * mmix-dis.c, * ppc-dis.c,
    	* riscv-dis.c, * s390-dis.c, * sparc-dis.c, * v850-dis.c: Use
    	opcodes_error_handler to print errors.  Standardize error messages.
    	* msp430-decode.opc, * nios2-dis.c, * rl78-decode.opc: Likewise,
    	and include opintl.h.
    	* nds32-asm.c: Likewise, and include sysdep.h and opintl.h.
    	* i386-gen.c: Standardize error messages.
    	* msp430-decode.c, * rl78-decode.c, rx-decode.c: Regenerate.
    	* Makefile.in: Regenerate.
    	* epiphany-asm.c, * epiphany-desc.c, * epiphany-dis.c,
    	* epiphany-ibld.c, * fr30-asm.c, * fr30-desc.c, * fr30-dis.c,
    	* fr30-ibld.c, * frv-asm.c, * frv-desc.c, * frv-dis.c, * frv-ibld.c,
    	* frv-opc.c, * ip2k-asm.c, * ip2k-desc.c, * ip2k-dis.c, * ip2k-ibld.c,
    	* iq2000-asm.c, * iq2000-desc.c, * iq2000-dis.c, * iq2000-ibld.c,
    	* lm32-asm.c, * lm32-desc.c, * lm32-dis.c, * lm32-ibld.c,
    	* m32c-asm.c, * m32c-desc.c, * m32c-dis.c, * m32c-ibld.c,
    	* m32r-asm.c, * m32r-desc.c, * m32r-dis.c, * m32r-ibld.c,
    	* mep-asm.c, * mep-desc.c, * mep-dis.c, * mep-ibld.c, * mt-asm.c,
    	* mt-desc.c, * mt-dis.c, * mt-ibld.c, * or1k-asm.c, * or1k-desc.c,
    	* or1k-dis.c, * or1k-ibld.c, * xc16x-asm.c, * xc16x-desc.c,
    	* xc16x-dis.c, * xc16x-ibld.c, * xstormy16-asm.c, * xstormy16-desc.c,
    	* xstormy16-dis.c, * xstormy16-ibld.c: Regenerate.

Diff:
---
 cpu/ChangeLog             |   7 +
 cpu/frv.opc               |  17 +-
 opcodes/ChangeLog         |  31 ++
 opcodes/Makefile.am       |   2 +-
 opcodes/Makefile.in       |   2 +-
 opcodes/aarch64-dis.c     |   2 +-
 opcodes/arc-dis.c         |   6 +-
 opcodes/arm-dis.c         |   7 +-
 opcodes/avr-dis.c         |   6 +-
 opcodes/d30v-dis.c        |   4 +-
 opcodes/epiphany-asm.c    |   4 +-
 opcodes/epiphany-desc.c   |  23 +-
 opcodes/epiphany-dis.c    |   7 +-
 opcodes/epiphany-ibld.c   |  30 +-
 opcodes/fr30-asm.c        |   4 +-
 opcodes/fr30-desc.c       |  23 +-
 opcodes/fr30-dis.c        |   7 +-
 opcodes/fr30-ibld.c       |  30 +-
 opcodes/frv-asm.c         |   4 +-
 opcodes/frv-desc.c        |  23 +-
 opcodes/frv-dis.c         |   7 +-
 opcodes/frv-ibld.c        |  30 +-
 opcodes/frv-opc.c         |  17 +-
 opcodes/h8300-dis.c       |   3 +-
 opcodes/i386-gen.c        |   8 +-
 opcodes/ip2k-asm.c        |   4 +-
 opcodes/ip2k-desc.c       |  23 +-
 opcodes/ip2k-dis.c        |   7 +-
 opcodes/ip2k-ibld.c       |  30 +-
 opcodes/iq2000-asm.c      |   4 +-
 opcodes/iq2000-desc.c     |  23 +-
 opcodes/iq2000-dis.c      |   7 +-
 opcodes/iq2000-ibld.c     |  30 +-
 opcodes/lm32-asm.c        |   4 +-
 opcodes/lm32-desc.c       |  23 +-
 opcodes/lm32-dis.c        |   7 +-
 opcodes/lm32-ibld.c       |  30 +-
 opcodes/m32c-asm.c        |   4 +-
 opcodes/m32c-desc.c       |  23 +-
 opcodes/m32c-dis.c        |   7 +-
 opcodes/m32c-ibld.c       |  30 +-
 opcodes/m32r-asm.c        |   4 +-
 opcodes/m32r-desc.c       |  23 +-
 opcodes/m32r-dis.c        |   7 +-
 opcodes/m32r-ibld.c       |  30 +-
 opcodes/mep-asm.c         |   4 +-
 opcodes/mep-desc.c        |  23 +-
 opcodes/mep-dis.c         |   7 +-
 opcodes/mep-ibld.c        |  30 +-
 opcodes/mmix-dis.c        |  31 +-
 opcodes/msp430-decode.c   | 206 ++++++------
 opcodes/msp430-decode.opc |   7 +-
 opcodes/mt-asm.c          |   4 +-
 opcodes/mt-desc.c         |  23 +-
 opcodes/mt-dis.c          |   7 +-
 opcodes/mt-ibld.c         |  30 +-
 opcodes/nds32-asm.c       |  19 +-
 opcodes/nios2-dis.c       |  13 +-
 opcodes/opc2c.c           |  10 +-
 opcodes/or1k-asm.c        |   4 +-
 opcodes/or1k-desc.c       |  23 +-
 opcodes/or1k-dis.c        |   7 +-
 opcodes/or1k-ibld.c       |  30 +-
 opcodes/ppc-dis.c         |   3 +-
 opcodes/riscv-dis.c       |   4 +-
 opcodes/rl78-decode.c     | 821 +++++++++++++++++++++++-----------------------
 opcodes/rl78-decode.opc   |   6 +-
 opcodes/rx-decode.c       |   1 +
 opcodes/s390-dis.c        |   3 +-
 opcodes/sparc-dis.c       |  22 +-
 opcodes/sysdep.h          |   3 +
 opcodes/v850-dis.c        |  16 +-
 opcodes/xc16x-asm.c       |   4 +-
 opcodes/xc16x-desc.c      |  23 +-
 opcodes/xc16x-dis.c       |   7 +-
 opcodes/xc16x-ibld.c      |  30 +-
 opcodes/xstormy16-asm.c   |   4 +-
 opcodes/xstormy16-desc.c  |  23 +-
 opcodes/xstormy16-dis.c   |   7 +-
 opcodes/xstormy16-ibld.c  |  30 +-
 80 files changed, 1234 insertions(+), 875 deletions(-)

diff --git a/cpu/ChangeLog b/cpu/ChangeLog
index 74156f8..5581d87 100644
--- a/cpu/ChangeLog
+++ b/cpu/ChangeLog
@@ -1,3 +1,10 @@
+2018-03-03  Alan Modra  <amodra@gmail.com>
+
+	* frv.opc: Include opintl.h.
+	(add_next_to_vliw): Use opcodes_error_handler to print error.
+	Standardize error message.
+	(fr500_check_insn_major_constraints, frv_vliw_add_insn): Likewise.
+
 2018-01-13  Nick Clifton  <nickc@redhat.com>
 
 	2.30 branch created.
diff --git a/cpu/frv.opc b/cpu/frv.opc
index 869155d..1b0b05c 100644
--- a/cpu/frv.opc
+++ b/cpu/frv.opc
@@ -78,6 +78,7 @@ int spr_valid           (long);
 /* -- */
 
 /* -- opc.c */
+#include "opintl.h"
 #include "elf/frv.h"
 #include <stdio.h>
 
@@ -500,9 +501,9 @@ add_next_to_vliw (FRV_VLIW *vliw, CGEN_ATTR_VALUE_ENUM_TYPE unit)
 
   if (next <= 0)
     {
-      fprintf (stderr, "frv-opc.c line %d: bad vliw->next_slot value.\n",
-	       __LINE__);
-      abort (); /* Should never happen.  */
+      /* xgettext:c-format */
+      opcodes_error_handler (_("internal error: bad vliw->next_slot value"));
+      abort ();
     }
 
   /* The table is sorted by units allowed within slots, so vliws with
@@ -810,8 +811,8 @@ fr500_check_insn_major_constraints (FRV_VLIW *vliw, CGEN_ATTR_VALUE_ENUM_TYPE ma
 	&&   ! find_major_in_vliw (vliw, FR500_MAJOR_F_6)
 	&&   ! find_major_in_vliw (vliw, FR500_MAJOR_F_7);
     default:
-      fprintf (stderr, "frv-opc.c, line %d: bad major code, aborting.\n",
-	       __LINE__);
+      /* xgettext:c-format */
+      opcodes_error_handler (_("internal error: bad major code"));
       abort ();
       break;
     }
@@ -860,9 +861,9 @@ frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn)
   unit = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_UNIT);
   if (unit == UNIT_NIL)
     {
-      fprintf (stderr, "frv-opc.c line %d: bad insn unit.\n",
-	       __LINE__);
-      abort (); /* No UNIT specified for this insn in frv.cpu.  */
+      /* xgettext:c-format */
+      opcodes_error_handler (_("internal error: bad insn unit"));
+      abort ();
     }
 
   switch (vliw->mach)
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 76929aa..9fe7a13 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,34 @@
+2018-03-03  Alan Modra  <amodra@gmail.com>
+
+	* sysdep.h (opcodes_error_handler): Define.
+	(_bfd_error_handler): Declare.
+	* Makefile.am: Remove stray #.
+	* opc2c.c (main): Remove bogus -l arg handling.  Print "DO NOT
+	EDIT" comment.
+	* aarch64-dis.c, * arc-dis.c, * arm-dis.c, * avr-dis.c,
+	* d30v-dis.c, * h8300-dis.c, * mmix-dis.c, * ppc-dis.c,
+	* riscv-dis.c, * s390-dis.c, * sparc-dis.c, * v850-dis.c: Use
+	opcodes_error_handler to print errors.  Standardize error messages.
+	* msp430-decode.opc, * nios2-dis.c, * rl78-decode.opc: Likewise,
+	and include opintl.h.
+	* nds32-asm.c: Likewise, and include sysdep.h and opintl.h.
+	* i386-gen.c: Standardize error messages.
+	* msp430-decode.c, * rl78-decode.c, rx-decode.c: Regenerate.
+	* Makefile.in: Regenerate.
+	* epiphany-asm.c, * epiphany-desc.c, * epiphany-dis.c,
+	* epiphany-ibld.c, * fr30-asm.c, * fr30-desc.c, * fr30-dis.c,
+	* fr30-ibld.c, * frv-asm.c, * frv-desc.c, * frv-dis.c, * frv-ibld.c,
+	* frv-opc.c, * ip2k-asm.c, * ip2k-desc.c, * ip2k-dis.c, * ip2k-ibld.c,
+	* iq2000-asm.c, * iq2000-desc.c, * iq2000-dis.c, * iq2000-ibld.c,
+	* lm32-asm.c, * lm32-desc.c, * lm32-dis.c, * lm32-ibld.c,
+	* m32c-asm.c, * m32c-desc.c, * m32c-dis.c, * m32c-ibld.c,
+	* m32r-asm.c, * m32r-desc.c, * m32r-dis.c, * m32r-ibld.c,
+	* mep-asm.c, * mep-desc.c, * mep-dis.c, * mep-ibld.c, * mt-asm.c,
+	* mt-desc.c, * mt-dis.c, * mt-ibld.c, * or1k-asm.c, * or1k-desc.c,
+	* or1k-dis.c, * or1k-ibld.c, * xc16x-asm.c, * xc16x-desc.c,
+	* xc16x-dis.c, * xc16x-ibld.c, * xstormy16-asm.c, * xstormy16-desc.c,
+	* xstormy16-dis.c, * xstormy16-ibld.c: Regenerate.
+
 2018-03-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* * i386-opc.tbl: Add "Optimize" to AVX256 and AVX512
diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
index 2458027..1b269a8 100644
--- a/opcodes/Makefile.am
+++ b/opcodes/Makefile.am
@@ -471,7 +471,7 @@ stamp-lm32: $(CGENDEPS) $(CPUDIR)/lm32.cpu $(CPUDIR)/lm32.opc
 		extrafiles=opinst
 
 $(srcdir)/m32c-desc.h $(srcdir)/m32c-desc.c $(srcdir)/m32c-opc.h $(srcdir)/m32c-opc.c $(srcdir)/m32c-ibld.c $(srcdir)/m32c-asm.c $(srcdir)/m32c-dis.c: $(M32C_DEPS)
-#	@true
+	@true
 stamp-m32c: $(CGENDEPS) $(CPUDIR)/m32c.cpu $(CPUDIR)/m32c.opc
 	$(MAKE) run-cgen arch=m32c prefix=m32c options= \
 		archfile=$(CPUDIR)/m32c.cpu \
diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in
index a130efc..baa07b9 100644
--- a/opcodes/Makefile.in
+++ b/opcodes/Makefile.in
@@ -1393,7 +1393,7 @@ stamp-lm32: $(CGENDEPS) $(CPUDIR)/lm32.cpu $(CPUDIR)/lm32.opc
 		extrafiles=opinst
 
 $(srcdir)/m32c-desc.h $(srcdir)/m32c-desc.c $(srcdir)/m32c-opc.h $(srcdir)/m32c-opc.c $(srcdir)/m32c-ibld.c $(srcdir)/m32c-asm.c $(srcdir)/m32c-dis.c: $(M32C_DEPS)
-#	@true
+	@true
 stamp-m32c: $(CGENDEPS) $(CPUDIR)/m32c.cpu $(CPUDIR)/m32c.opc
 	$(MAKE) run-cgen arch=m32c prefix=m32c options= \
 		archfile=$(CPUDIR)/m32c.cpu \
diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c
index a7f5cfc..c63f595 100644
--- a/opcodes/aarch64-dis.c
+++ b/opcodes/aarch64-dis.c
@@ -78,7 +78,7 @@ parse_aarch64_dis_option (const char *option, unsigned int len ATTRIBUTE_UNUSED)
 #endif /* DEBUG_AARCH64 */
 
   /* Invalid option.  */
-  fprintf (stderr, _("Unrecognised disassembler option: %s\n"), option);
+  opcodes_error_handler (_("unrecognised disassembler option: %s"), option);
 }
 
 static void
diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c
index cb72542..feb4ca8 100644
--- a/opcodes/arc-dis.c
+++ b/opcodes/arc-dis.c
@@ -778,7 +778,8 @@ parse_option (const char *option)
   else if (CONST_STRNEQ (option, "hex"))
     print_hex = TRUE;
   else
-    fprintf (stderr, _("Unrecognised disassembler option: %s\n"), option);
+    /* xgettext:c-format */
+    opcodes_error_handler (_("unrecognised disassembler option: %s"), option);
 }
 
 #define ARC_CPU_TYPE_A6xx(NAME,EXTRA)			\
@@ -820,7 +821,8 @@ parse_cpu_option (const char *option)
 	}
     }
 
-  fprintf (stderr, _("Unrecognised disassembler CPU option: %s\n"), option);
+  /* xgettext:c-format */
+  opcodes_error_handler (_("unrecognised disassembler CPU option: %s"), option);
   return ARC_OPCODE_NONE;
 }
 
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index f0fc93c..6f93cfd 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -6145,14 +6145,17 @@ parse_arm_disassembler_options (const char *options)
 	      }
 
 	  if (i >= NUM_ARM_OPTIONS)
-	    fprintf (stderr, _("Unrecognised register name set: %s\n"), opt);
+	    /* xgettext: c-format */
+	    opcodes_error_handler (_("unrecognised register name set: %s"),
+				   opt);
 	}
       else if (CONST_STRNEQ (opt, "force-thumb"))
 	force_thumb = 1;
       else if (CONST_STRNEQ (opt, "no-force-thumb"))
 	force_thumb = 0;
       else
-	fprintf (stderr, _("Unrecognised disassembler option: %s\n"), opt);
+	/* xgettext: c-format */
+	opcodes_error_handler (_("unrecognised disassembler option: %s"), opt);
     }
 
   return;
diff --git a/opcodes/avr-dis.c b/opcodes/avr-dis.c
index 16467b8..6a37c6e 100644
--- a/opcodes/avr-dis.c
+++ b/opcodes/avr-dis.c
@@ -212,7 +212,8 @@ avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constra
 
     case 'n':
       sprintf (buf, "??");
-      fprintf (stderr, _("Internal disassembler error"));
+      /* xgettext:c-format */
+      opcodes_error_handler (_("internal disassembler error"));
       ok = 0;
       break;
 
@@ -265,7 +266,8 @@ avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constra
 
     default:
       sprintf (buf, "??");
-      fprintf (stderr, _("unknown constraint `%c'"), constraint);
+      /* xgettext:c-format */
+      opcodes_error_handler (_("unknown constraint `%c'"), constraint);
       ok = 0;
     }
 
diff --git a/opcodes/d30v-dis.c b/opcodes/d30v-dis.c
index 63f64fb..f878343 100644
--- a/opcodes/d30v-dis.c
+++ b/opcodes/d30v-dis.c
@@ -225,7 +225,9 @@ print_insn (struct disassemble_info *info,
 		  val |= OPERAND_FLAG;
 		  break;
 		default:
-		  fprintf (stderr, "illegal id (%d)\n", id);
+		  /* xgettext: c-format */
+		  opcodes_error_handler (_("illegal id (%d)"), id);
+		  abort ();
 		}
 	    }
 	  else if (oper->flags & OPERAND_ACC)
diff --git a/opcodes/epiphany-asm.c b/opcodes/epiphany-asm.c
index 501ee6d..6fa49c0 100644
--- a/opcodes/epiphany-asm.c
+++ b/opcodes/epiphany-asm.c
@@ -452,7 +452,9 @@ epiphany_cgen_parse_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while parsing.\n"), opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while parsing"),
+	 opindex);
       abort ();
   }
 
diff --git a/opcodes/epiphany-desc.c b/opcodes/epiphany-desc.c
index ab1ee13..41c7d62 100644
--- a/opcodes/epiphany-desc.c
+++ b/opcodes/epiphany-desc.c
@@ -1939,6 +1939,11 @@ init_tables (void)
 {
 }
 
+#ifndef opcodes_error_handler
+#define opcodes_error_handler(...) \
+  fprintf (stderr, __VA_ARGS__); fputc ('\n', stderr)
+#endif
+
 static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *);
 static void build_hw_table      (CGEN_CPU_TABLE *);
 static void build_ifield_table  (CGEN_CPU_TABLE *);
@@ -2099,8 +2104,11 @@ epiphany_cgen_rebuild_tables (CGEN_CPU_TABLE *cd)
 	{
 	  if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
 	    {
-	      fprintf (stderr, "epiphany_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\n",
-		       cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
+	      opcodes_error_handler
+		(/* xgettext:c-format */
+		 _("internal error: epiphany_cgen_rebuild_tables: "
+		   "conflicting insn-chunk-bitsize values: `%d' vs. `%d'"),
+		 cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
 	      abort ();
 	    }
 
@@ -2179,8 +2187,11 @@ epiphany_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
 	  endian = va_arg (ap, enum cgen_endian);
 	  break;
 	default :
-	  fprintf (stderr, "epiphany_cgen_cpu_open: unsupported argument `%d'\n",
-		   arg_type);
+	  opcodes_error_handler
+	    (/* xgettext:c-format */
+	     _("internal error: epiphany_cgen_cpu_open: "
+	       "unsupported argument `%d'"),
+	     arg_type);
 	  abort (); /* ??? return NULL? */
 	}
       arg_type = va_arg (ap, enum cgen_cpu_open_arg);
@@ -2195,7 +2206,9 @@ epiphany_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
   if (endian == CGEN_ENDIAN_UNKNOWN)
     {
       /* ??? If target has only one, could have a default.  */
-      fprintf (stderr, "epiphany_cgen_cpu_open: no endianness specified\n");
+      opcodes_error_handler
+	(/* xgettext:c-format */
+	 _("internal error: epiphany_cgen_cpu_open: no endianness specified"));
       abort ();
     }
 
diff --git a/opcodes/epiphany-dis.c b/opcodes/epiphany-dis.c
index c8c2d8d..d4ad501 100644
--- a/opcodes/epiphany-dis.c
+++ b/opcodes/epiphany-dis.c
@@ -275,9 +275,10 @@ epiphany_cgen_print_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while printing insn.\n"),
-	       opindex);
-    abort ();
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while printing insn"),
+	 opindex);
+      abort ();
   }
 }
 
diff --git a/opcodes/epiphany-ibld.c b/opcodes/epiphany-ibld.c
index 8b1f4b9..37cbe39 100644
--- a/opcodes/epiphany-ibld.c
+++ b/opcodes/epiphany-ibld.c
@@ -876,8 +876,9 @@ epiphany_cgen_insert_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while building insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while building insn"),
+	 opindex);
       abort ();
   }
 
@@ -1170,8 +1171,9 @@ epiphany_cgen_extract_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while decoding insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while decoding insn"),
+	 opindex);
       abort ();
     }
 
@@ -1313,8 +1315,9 @@ epiphany_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting int operand"),
+	 opindex);
       abort ();
   }
 
@@ -1438,8 +1441,9 @@ epiphany_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting vma operand"),
+	 opindex);
       abort ();
   }
 
@@ -1570,8 +1574,9 @@ epiphany_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting int operand"),
+	 opindex);
       abort ();
   }
 }
@@ -1692,8 +1697,9 @@ epiphany_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting vma operand"),
+	 opindex);
       abort ();
   }
 }
diff --git a/opcodes/fr30-asm.c b/opcodes/fr30-asm.c
index 302d4d2..a52a780 100644
--- a/opcodes/fr30-asm.c
+++ b/opcodes/fr30-asm.c
@@ -307,7 +307,9 @@ fr30_cgen_parse_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while parsing.\n"), opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while parsing"),
+	 opindex);
       abort ();
   }
 
diff --git a/opcodes/fr30-desc.c b/opcodes/fr30-desc.c
index 511e117..ba7cb39 100644
--- a/opcodes/fr30-desc.c
+++ b/opcodes/fr30-desc.c
@@ -1416,6 +1416,11 @@ init_tables (void)
 {
 }
 
+#ifndef opcodes_error_handler
+#define opcodes_error_handler(...) \
+  fprintf (stderr, __VA_ARGS__); fputc ('\n', stderr)
+#endif
+
 static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *);
 static void build_hw_table      (CGEN_CPU_TABLE *);
 static void build_ifield_table  (CGEN_CPU_TABLE *);
@@ -1576,8 +1581,11 @@ fr30_cgen_rebuild_tables (CGEN_CPU_TABLE *cd)
 	{
 	  if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
 	    {
-	      fprintf (stderr, "fr30_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\n",
-		       cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
+	      opcodes_error_handler
+		(/* xgettext:c-format */
+		 _("internal error: fr30_cgen_rebuild_tables: "
+		   "conflicting insn-chunk-bitsize values: `%d' vs. `%d'"),
+		 cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
 	      abort ();
 	    }
 
@@ -1656,8 +1664,11 @@ fr30_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
 	  endian = va_arg (ap, enum cgen_endian);
 	  break;
 	default :
-	  fprintf (stderr, "fr30_cgen_cpu_open: unsupported argument `%d'\n",
-		   arg_type);
+	  opcodes_error_handler
+	    (/* xgettext:c-format */
+	     _("internal error: fr30_cgen_cpu_open: "
+	       "unsupported argument `%d'"),
+	     arg_type);
 	  abort (); /* ??? return NULL? */
 	}
       arg_type = va_arg (ap, enum cgen_cpu_open_arg);
@@ -1672,7 +1683,9 @@ fr30_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
   if (endian == CGEN_ENDIAN_UNKNOWN)
     {
       /* ??? If target has only one, could have a default.  */
-      fprintf (stderr, "fr30_cgen_cpu_open: no endianness specified\n");
+      opcodes_error_handler
+	(/* xgettext:c-format */
+	 _("internal error: fr30_cgen_cpu_open: no endianness specified"));
       abort ();
     }
 
diff --git a/opcodes/fr30-dis.c b/opcodes/fr30-dis.c
index a659545..6a60eef 100644
--- a/opcodes/fr30-dis.c
+++ b/opcodes/fr30-dis.c
@@ -296,9 +296,10 @@ fr30_cgen_print_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while printing insn.\n"),
-	       opindex);
-    abort ();
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while printing insn"),
+	 opindex);
+      abort ();
   }
 }
 
diff --git a/opcodes/fr30-ibld.c b/opcodes/fr30-ibld.c
index d3e7fc5..25d0e07 100644
--- a/opcodes/fr30-ibld.c
+++ b/opcodes/fr30-ibld.c
@@ -731,8 +731,9 @@ fr30_cgen_insert_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while building insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while building insn"),
+	 opindex);
       abort ();
   }
 
@@ -936,8 +937,9 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while decoding insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while decoding insn"),
+	 opindex);
       abort ();
     }
 
@@ -1082,8 +1084,9 @@ fr30_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting int operand"),
+	 opindex);
       abort ();
   }
 
@@ -1210,8 +1213,9 @@ fr30_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting vma operand"),
+	 opindex);
       abort ();
   }
 
@@ -1341,8 +1345,9 @@ fr30_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting int operand"),
+	 opindex);
       abort ();
   }
 }
@@ -1462,8 +1467,9 @@ fr30_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting vma operand"),
+	 opindex);
       abort ();
   }
 }
diff --git a/opcodes/frv-asm.c b/opcodes/frv-asm.c
index 60a0f4c..12b8ee2 100644
--- a/opcodes/frv-asm.c
+++ b/opcodes/frv-asm.c
@@ -1260,7 +1260,9 @@ frv_cgen_parse_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while parsing.\n"), opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while parsing"),
+	 opindex);
       abort ();
   }
 
diff --git a/opcodes/frv-desc.c b/opcodes/frv-desc.c
index b3d8387..1e65b47 100644
--- a/opcodes/frv-desc.c
+++ b/opcodes/frv-desc.c
@@ -6156,6 +6156,11 @@ init_tables (void)
 {
 }
 
+#ifndef opcodes_error_handler
+#define opcodes_error_handler(...) \
+  fprintf (stderr, __VA_ARGS__); fputc ('\n', stderr)
+#endif
+
 static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *);
 static void build_hw_table      (CGEN_CPU_TABLE *);
 static void build_ifield_table  (CGEN_CPU_TABLE *);
@@ -6316,8 +6321,11 @@ frv_cgen_rebuild_tables (CGEN_CPU_TABLE *cd)
 	{
 	  if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
 	    {
-	      fprintf (stderr, "frv_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\n",
-		       cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
+	      opcodes_error_handler
+		(/* xgettext:c-format */
+		 _("internal error: frv_cgen_rebuild_tables: "
+		   "conflicting insn-chunk-bitsize values: `%d' vs. `%d'"),
+		 cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
 	      abort ();
 	    }
 
@@ -6396,8 +6404,11 @@ frv_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
 	  endian = va_arg (ap, enum cgen_endian);
 	  break;
 	default :
-	  fprintf (stderr, "frv_cgen_cpu_open: unsupported argument `%d'\n",
-		   arg_type);
+	  opcodes_error_handler
+	    (/* xgettext:c-format */
+	     _("internal error: frv_cgen_cpu_open: "
+	       "unsupported argument `%d'"),
+	     arg_type);
 	  abort (); /* ??? return NULL? */
 	}
       arg_type = va_arg (ap, enum cgen_cpu_open_arg);
@@ -6412,7 +6423,9 @@ frv_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
   if (endian == CGEN_ENDIAN_UNKNOWN)
     {
       /* ??? If target has only one, could have a default.  */
-      fprintf (stderr, "frv_cgen_cpu_open: no endianness specified\n");
+      opcodes_error_handler
+	(/* xgettext:c-format */
+	 _("internal error: frv_cgen_cpu_open: no endianness specified"));
       abort ();
     }
 
diff --git a/opcodes/frv-dis.c b/opcodes/frv-dis.c
index 262ff65..af844f7 100644
--- a/opcodes/frv-dis.c
+++ b/opcodes/frv-dis.c
@@ -393,9 +393,10 @@ frv_cgen_print_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while printing insn.\n"),
-	       opindex);
-    abort ();
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while printing insn"),
+	 opindex);
+      abort ();
   }
 }
 
diff --git a/opcodes/frv-ibld.c b/opcodes/frv-ibld.c
index 2251ee0..bf6f962 100644
--- a/opcodes/frv-ibld.c
+++ b/opcodes/frv-ibld.c
@@ -857,8 +857,9 @@ frv_cgen_insert_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while building insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while building insn"),
+	 opindex);
       abort ();
   }
 
@@ -1174,8 +1175,9 @@ frv_cgen_extract_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while decoding insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while decoding insn"),
+	 opindex);
       abort ();
     }
 
@@ -1452,8 +1454,9 @@ frv_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting int operand"),
+	 opindex);
       abort ();
   }
 
@@ -1712,8 +1715,9 @@ frv_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting vma operand"),
+	 opindex);
       abort ();
   }
 
@@ -1979,8 +1983,9 @@ frv_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting int operand"),
+	 opindex);
       abort ();
   }
 }
@@ -2236,8 +2241,9 @@ frv_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting vma operand"),
+	 opindex);
       abort ();
   }
 }
diff --git a/opcodes/frv-opc.c b/opcodes/frv-opc.c
index 0669f23..67628c2c 100644
--- a/opcodes/frv-opc.c
+++ b/opcodes/frv-opc.c
@@ -32,6 +32,7 @@ This file is part of the GNU Binutils and/or GDB, the GNU debugger.
 #include "libiberty.h"
 
 /* -- opc.c */
+#include "opintl.h"
 #include "elf/frv.h"
 #include <stdio.h>
 
@@ -454,9 +455,9 @@ add_next_to_vliw (FRV_VLIW *vliw, CGEN_ATTR_VALUE_ENUM_TYPE unit)
 
   if (next <= 0)
     {
-      fprintf (stderr, "frv-opc.c line %d: bad vliw->next_slot value.\n",
-	       __LINE__);
-      abort (); /* Should never happen.  */
+      /* xgettext:c-format */
+      opcodes_error_handler (_("internal error: bad vliw->next_slot value"));
+      abort ();
     }
 
   /* The table is sorted by units allowed within slots, so vliws with
@@ -764,8 +765,8 @@ fr500_check_insn_major_constraints (FRV_VLIW *vliw, CGEN_ATTR_VALUE_ENUM_TYPE ma
 	&&   ! find_major_in_vliw (vliw, FR500_MAJOR_F_6)
 	&&   ! find_major_in_vliw (vliw, FR500_MAJOR_F_7);
     default:
-      fprintf (stderr, "frv-opc.c, line %d: bad major code, aborting.\n",
-	       __LINE__);
+      /* xgettext:c-format */
+      opcodes_error_handler (_("internal error: bad major code"));
       abort ();
       break;
     }
@@ -814,9 +815,9 @@ frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn)
   unit = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_UNIT);
   if (unit == UNIT_NIL)
     {
-      fprintf (stderr, "frv-opc.c line %d: bad insn unit.\n",
-	       __LINE__);
-      abort (); /* No UNIT specified for this insn in frv.cpu.  */
+      /* xgettext:c-format */
+      opcodes_error_handler (_("internal error: bad insn unit"));
+      abort ();
     }
 
   switch (vliw->mach)
diff --git a/opcodes/h8300-dis.c b/opcodes/h8300-dis.c
index 2b504eb..d9e5c9d 100644
--- a/opcodes/h8300-dis.c
+++ b/opcodes/h8300-dis.c
@@ -59,7 +59,8 @@ bfd_h8_disassemble_init (void)
 
       if (i & 1)
 	{
-	  fprintf (stderr, "Internal error, h8_disassemble_init.\n");
+	  /* xgettext:c-format */
+	  opcodes_error_handler (_("internal error, h8_disassemble_init"));
 	  abort ();
 	}
 
diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c
index 669ac0c..abd4ebf 100644
--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -722,7 +722,7 @@ fail (const char *message, ...)
   va_list args;
 
   va_start (args, message);
-  fprintf (stderr, _("%s: Error: "), program_name);
+  fprintf (stderr, _("%s: error: "), program_name);
   vfprintf (stderr, message, args);
   va_end (args);
   xexit (1);
@@ -901,9 +901,9 @@ set_bitfield (char *f, bitfield *array, int value,
     return;
 
   if (lineno != -1)
-    fail (_("%s: %d: Unknown bitfield: %s\n"), filename, lineno, f);
+    fail (_("%s: %d: unknown bitfield: %s\n"), filename, lineno, f);
   else
-    fail (_("Unknown bitfield: %s\n"), f);
+    fail (_("unknown bitfield: %s\n"), f);
 }
 
 static void
@@ -966,7 +966,7 @@ process_i386_cpu_flag (FILE *table, char *flag, int macro,
 	  last -= 1;
 	  next = flag + 2;
 	  if (*last != ')')
-	    fail (_("%s: %d: Missing `)' in bitfield: %s\n"), filename,
+	    fail (_("%s: %d: missing `)' in bitfield: %s\n"), filename,
 		  lineno, flag);
 	  *last = '\0';
 	}
diff --git a/opcodes/ip2k-asm.c b/opcodes/ip2k-asm.c
index 3a351f1..3b2d1d1 100644
--- a/opcodes/ip2k-asm.c
+++ b/opcodes/ip2k-asm.c
@@ -508,7 +508,9 @@ ip2k_cgen_parse_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while parsing.\n"), opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while parsing"),
+	 opindex);
       abort ();
   }
 
diff --git a/opcodes/ip2k-desc.c b/opcodes/ip2k-desc.c
index 7617f2c..69444a1 100644
--- a/opcodes/ip2k-desc.c
+++ b/opcodes/ip2k-desc.c
@@ -845,6 +845,11 @@ init_tables (void)
 {
 }
 
+#ifndef opcodes_error_handler
+#define opcodes_error_handler(...) \
+  fprintf (stderr, __VA_ARGS__); fputc ('\n', stderr)
+#endif
+
 static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *);
 static void build_hw_table      (CGEN_CPU_TABLE *);
 static void build_ifield_table  (CGEN_CPU_TABLE *);
@@ -1005,8 +1010,11 @@ ip2k_cgen_rebuild_tables (CGEN_CPU_TABLE *cd)
 	{
 	  if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
 	    {
-	      fprintf (stderr, "ip2k_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\n",
-		       cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
+	      opcodes_error_handler
+		(/* xgettext:c-format */
+		 _("internal error: ip2k_cgen_rebuild_tables: "
+		   "conflicting insn-chunk-bitsize values: `%d' vs. `%d'"),
+		 cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
 	      abort ();
 	    }
 
@@ -1085,8 +1093,11 @@ ip2k_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
 	  endian = va_arg (ap, enum cgen_endian);
 	  break;
 	default :
-	  fprintf (stderr, "ip2k_cgen_cpu_open: unsupported argument `%d'\n",
-		   arg_type);
+	  opcodes_error_handler
+	    (/* xgettext:c-format */
+	     _("internal error: ip2k_cgen_cpu_open: "
+	       "unsupported argument `%d'"),
+	     arg_type);
 	  abort (); /* ??? return NULL? */
 	}
       arg_type = va_arg (ap, enum cgen_cpu_open_arg);
@@ -1101,7 +1112,9 @@ ip2k_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
   if (endian == CGEN_ENDIAN_UNKNOWN)
     {
       /* ??? If target has only one, could have a default.  */
-      fprintf (stderr, "ip2k_cgen_cpu_open: no endianness specified\n");
+      opcodes_error_handler
+	(/* xgettext:c-format */
+	 _("internal error: ip2k_cgen_cpu_open: no endianness specified"));
       abort ();
     }
 
diff --git a/opcodes/ip2k-dis.c b/opcodes/ip2k-dis.c
index 5212593..5e32903 100644
--- a/opcodes/ip2k-dis.c
+++ b/opcodes/ip2k-dis.c
@@ -285,9 +285,10 @@ ip2k_cgen_print_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while printing insn.\n"),
-	       opindex);
-    abort ();
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while printing insn"),
+	 opindex);
+      abort ();
   }
 }
 
diff --git a/opcodes/ip2k-ibld.c b/opcodes/ip2k-ibld.c
index 7d031dc..49b8439 100644
--- a/opcodes/ip2k-ibld.c
+++ b/opcodes/ip2k-ibld.c
@@ -608,8 +608,9 @@ ip2k_cgen_insert_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while building insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while building insn"),
+	 opindex);
       abort ();
   }
 
@@ -683,8 +684,9 @@ ip2k_cgen_extract_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while decoding insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while decoding insn"),
+	 opindex);
       abort ();
     }
 
@@ -757,8 +759,9 @@ ip2k_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting int operand"),
+	 opindex);
       abort ();
   }
 
@@ -813,8 +816,9 @@ ip2k_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting vma operand"),
+	 opindex);
       abort ();
   }
 
@@ -872,8 +876,9 @@ ip2k_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting int operand"),
+	 opindex);
       abort ();
   }
 }
@@ -921,8 +926,9 @@ ip2k_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting vma operand"),
+	 opindex);
       abort ();
   }
 }
diff --git a/opcodes/iq2000-asm.c b/opcodes/iq2000-asm.c
index 955f43a..284acce 100644
--- a/opcodes/iq2000-asm.c
+++ b/opcodes/iq2000-asm.c
@@ -456,7 +456,9 @@ iq2000_cgen_parse_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while parsing.\n"), opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while parsing"),
+	 opindex);
       abort ();
   }
 
diff --git a/opcodes/iq2000-desc.c b/opcodes/iq2000-desc.c
index 717f37a..8f639fd 100644
--- a/opcodes/iq2000-desc.c
+++ b/opcodes/iq2000-desc.c
@@ -1850,6 +1850,11 @@ init_tables (void)
 {
 }
 
+#ifndef opcodes_error_handler
+#define opcodes_error_handler(...) \
+  fprintf (stderr, __VA_ARGS__); fputc ('\n', stderr)
+#endif
+
 static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *);
 static void build_hw_table      (CGEN_CPU_TABLE *);
 static void build_ifield_table  (CGEN_CPU_TABLE *);
@@ -2010,8 +2015,11 @@ iq2000_cgen_rebuild_tables (CGEN_CPU_TABLE *cd)
 	{
 	  if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
 	    {
-	      fprintf (stderr, "iq2000_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\n",
-		       cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
+	      opcodes_error_handler
+		(/* xgettext:c-format */
+		 _("internal error: iq2000_cgen_rebuild_tables: "
+		   "conflicting insn-chunk-bitsize values: `%d' vs. `%d'"),
+		 cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
 	      abort ();
 	    }
 
@@ -2090,8 +2098,11 @@ iq2000_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
 	  endian = va_arg (ap, enum cgen_endian);
 	  break;
 	default :
-	  fprintf (stderr, "iq2000_cgen_cpu_open: unsupported argument `%d'\n",
-		   arg_type);
+	  opcodes_error_handler
+	    (/* xgettext:c-format */
+	     _("internal error: iq2000_cgen_cpu_open: "
+	       "unsupported argument `%d'"),
+	     arg_type);
 	  abort (); /* ??? return NULL? */
 	}
       arg_type = va_arg (ap, enum cgen_cpu_open_arg);
@@ -2106,7 +2117,9 @@ iq2000_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
   if (endian == CGEN_ENDIAN_UNKNOWN)
     {
       /* ??? If target has only one, could have a default.  */
-      fprintf (stderr, "iq2000_cgen_cpu_open: no endianness specified\n");
+      opcodes_error_handler
+	(/* xgettext:c-format */
+	 _("internal error: iq2000_cgen_cpu_open: no endianness specified"));
       abort ();
     }
 
diff --git a/opcodes/iq2000-dis.c b/opcodes/iq2000-dis.c
index a8dcc55..d173333 100644
--- a/opcodes/iq2000-dis.c
+++ b/opcodes/iq2000-dis.c
@@ -186,9 +186,10 @@ iq2000_cgen_print_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while printing insn.\n"),
-	       opindex);
-    abort ();
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while printing insn"),
+	 opindex);
+      abort ();
   }
 }
 
diff --git a/opcodes/iq2000-ibld.c b/opcodes/iq2000-ibld.c
index 73bd75b..023a2cb 100644
--- a/opcodes/iq2000-ibld.c
+++ b/opcodes/iq2000-ibld.c
@@ -714,8 +714,9 @@ iq2000_cgen_insert_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while building insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while building insn"),
+	 opindex);
       abort ();
   }
 
@@ -889,8 +890,9 @@ iq2000_cgen_extract_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while decoding insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while decoding insn"),
+	 opindex);
       abort ();
     }
 
@@ -1020,8 +1022,9 @@ iq2000_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting int operand"),
+	 opindex);
       abort ();
   }
 
@@ -1133,8 +1136,9 @@ iq2000_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting vma operand"),
+	 opindex);
       abort ();
   }
 
@@ -1253,8 +1257,9 @@ iq2000_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting int operand"),
+	 opindex);
       abort ();
   }
 }
@@ -1363,8 +1368,9 @@ iq2000_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting vma operand"),
+	 opindex);
       abort ();
   }
 }
diff --git a/opcodes/lm32-asm.c b/opcodes/lm32-asm.c
index afc70ff..46c1a83 100644
--- a/opcodes/lm32-asm.c
+++ b/opcodes/lm32-asm.c
@@ -346,7 +346,9 @@ lm32_cgen_parse_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while parsing.\n"), opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while parsing"),
+	 opindex);
       abort ();
   }
 
diff --git a/opcodes/lm32-desc.c b/opcodes/lm32-desc.c
index 4b8751c..71dafa9 100644
--- a/opcodes/lm32-desc.c
+++ b/opcodes/lm32-desc.c
@@ -832,6 +832,11 @@ init_tables (void)
 {
 }
 
+#ifndef opcodes_error_handler
+#define opcodes_error_handler(...) \
+  fprintf (stderr, __VA_ARGS__); fputc ('\n', stderr)
+#endif
+
 static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *);
 static void build_hw_table      (CGEN_CPU_TABLE *);
 static void build_ifield_table  (CGEN_CPU_TABLE *);
@@ -992,8 +997,11 @@ lm32_cgen_rebuild_tables (CGEN_CPU_TABLE *cd)
 	{
 	  if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
 	    {
-	      fprintf (stderr, "lm32_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\n",
-		       cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
+	      opcodes_error_handler
+		(/* xgettext:c-format */
+		 _("internal error: lm32_cgen_rebuild_tables: "
+		   "conflicting insn-chunk-bitsize values: `%d' vs. `%d'"),
+		 cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
 	      abort ();
 	    }
 
@@ -1072,8 +1080,11 @@ lm32_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
 	  endian = va_arg (ap, enum cgen_endian);
 	  break;
 	default :
-	  fprintf (stderr, "lm32_cgen_cpu_open: unsupported argument `%d'\n",
-		   arg_type);
+	  opcodes_error_handler
+	    (/* xgettext:c-format */
+	     _("internal error: lm32_cgen_cpu_open: "
+	       "unsupported argument `%d'"),
+	     arg_type);
 	  abort (); /* ??? return NULL? */
 	}
       arg_type = va_arg (ap, enum cgen_cpu_open_arg);
@@ -1088,7 +1099,9 @@ lm32_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
   if (endian == CGEN_ENDIAN_UNKNOWN)
     {
       /* ??? If target has only one, could have a default.  */
-      fprintf (stderr, "lm32_cgen_cpu_open: no endianness specified\n");
+      opcodes_error_handler
+	(/* xgettext:c-format */
+	 _("internal error: lm32_cgen_cpu_open: no endianness specified"));
       abort ();
     }
 
diff --git a/opcodes/lm32-dis.c b/opcodes/lm32-dis.c
index f5b7654..90e67c7 100644
--- a/opcodes/lm32-dis.c
+++ b/opcodes/lm32-dis.c
@@ -144,9 +144,10 @@ lm32_cgen_print_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while printing insn.\n"),
-	       opindex);
-    abort ();
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while printing insn"),
+	 opindex);
+      abort ();
   }
 }
 
diff --git a/opcodes/lm32-ibld.c b/opcodes/lm32-ibld.c
index a177616..ecddfbd 100644
--- a/opcodes/lm32-ibld.c
+++ b/opcodes/lm32-ibld.c
@@ -635,8 +635,9 @@ lm32_cgen_insert_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while building insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while building insn"),
+	 opindex);
       abort ();
   }
 
@@ -739,8 +740,9 @@ lm32_cgen_extract_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while decoding insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while decoding insn"),
+	 opindex);
       abort ();
     }
 
@@ -828,8 +830,9 @@ lm32_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting int operand"),
+	 opindex);
       abort ();
   }
 
@@ -899,8 +902,9 @@ lm32_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting vma operand"),
+	 opindex);
       abort ();
   }
 
@@ -977,8 +981,9 @@ lm32_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting int operand"),
+	 opindex);
       abort ();
   }
 }
@@ -1045,8 +1050,9 @@ lm32_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting vma operand"),
+	 opindex);
       abort ();
   }
 }
diff --git a/opcodes/m32c-asm.c b/opcodes/m32c-asm.c
index 98228f0..206eaaf 100644
--- a/opcodes/m32c-asm.c
+++ b/opcodes/m32c-asm.c
@@ -1581,7 +1581,9 @@ m32c_cgen_parse_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while parsing.\n"), opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while parsing"),
+	 opindex);
       abort ();
   }
 
diff --git a/opcodes/m32c-desc.c b/opcodes/m32c-desc.c
index 813014a..931f90d 100644
--- a/opcodes/m32c-desc.c
+++ b/opcodes/m32c-desc.c
@@ -62863,6 +62863,11 @@ init_tables (void)
 {
 }
 
+#ifndef opcodes_error_handler
+#define opcodes_error_handler(...) \
+  fprintf (stderr, __VA_ARGS__); fputc ('\n', stderr)
+#endif
+
 static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *);
 static void build_hw_table      (CGEN_CPU_TABLE *);
 static void build_ifield_table  (CGEN_CPU_TABLE *);
@@ -63023,8 +63028,11 @@ m32c_cgen_rebuild_tables (CGEN_CPU_TABLE *cd)
 	{
 	  if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
 	    {
-	      fprintf (stderr, "m32c_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\n",
-		       cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
+	      opcodes_error_handler
+		(/* xgettext:c-format */
+		 _("internal error: m32c_cgen_rebuild_tables: "
+		   "conflicting insn-chunk-bitsize values: `%d' vs. `%d'"),
+		 cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
 	      abort ();
 	    }
 
@@ -63103,8 +63111,11 @@ m32c_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
 	  endian = va_arg (ap, enum cgen_endian);
 	  break;
 	default :
-	  fprintf (stderr, "m32c_cgen_cpu_open: unsupported argument `%d'\n",
-		   arg_type);
+	  opcodes_error_handler
+	    (/* xgettext:c-format */
+	     _("internal error: m32c_cgen_cpu_open: "
+	       "unsupported argument `%d'"),
+	     arg_type);
 	  abort (); /* ??? return NULL? */
 	}
       arg_type = va_arg (ap, enum cgen_cpu_open_arg);
@@ -63119,7 +63130,9 @@ m32c_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
   if (endian == CGEN_ENDIAN_UNKNOWN)
     {
       /* ??? If target has only one, could have a default.  */
-      fprintf (stderr, "m32c_cgen_cpu_open: no endianness specified\n");
+      opcodes_error_handler
+	(/* xgettext:c-format */
+	 _("internal error: m32c_cgen_cpu_open: no endianness specified"));
       abort ();
     }
 
diff --git a/opcodes/m32c-dis.c b/opcodes/m32c-dis.c
index e7f65fd..fc8ee0b 100644
--- a/opcodes/m32c-dis.c
+++ b/opcodes/m32c-dis.c
@@ -888,9 +888,10 @@ m32c_cgen_print_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while printing insn.\n"),
-	       opindex);
-    abort ();
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while printing insn"),
+	 opindex);
+      abort ();
   }
 }
 
diff --git a/opcodes/m32c-ibld.c b/opcodes/m32c-ibld.c
index bbdd0f9..ab35e51 100644
--- a/opcodes/m32c-ibld.c
+++ b/opcodes/m32c-ibld.c
@@ -1732,8 +1732,9 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while building insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while building insn"),
+	 opindex);
       abort ();
   }
 
@@ -2893,8 +2894,9 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while decoding insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while decoding insn"),
+	 opindex);
       abort ();
     }
 
@@ -3510,8 +3512,9 @@ m32c_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting int operand"),
+	 opindex);
       abort ();
   }
 
@@ -4109,8 +4112,9 @@ m32c_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting vma operand"),
+	 opindex);
       abort ();
   }
 
@@ -4696,8 +4700,9 @@ m32c_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting int operand"),
+	 opindex);
       abort ();
   }
 }
@@ -5273,8 +5278,9 @@ m32c_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting vma operand"),
+	 opindex);
       abort ();
   }
 }
diff --git a/opcodes/m32r-asm.c b/opcodes/m32r-asm.c
index d530b1d..6404516 100644
--- a/opcodes/m32r-asm.c
+++ b/opcodes/m32r-asm.c
@@ -325,7 +325,9 @@ m32r_cgen_parse_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while parsing.\n"), opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while parsing"),
+	 opindex);
       abort ();
   }
 
diff --git a/opcodes/m32r-desc.c b/opcodes/m32r-desc.c
index 85e3494..2d74dba 100644
--- a/opcodes/m32r-desc.c
+++ b/opcodes/m32r-desc.c
@@ -1195,6 +1195,11 @@ init_tables (void)
 {
 }
 
+#ifndef opcodes_error_handler
+#define opcodes_error_handler(...) \
+  fprintf (stderr, __VA_ARGS__); fputc ('\n', stderr)
+#endif
+
 static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *);
 static void build_hw_table      (CGEN_CPU_TABLE *);
 static void build_ifield_table  (CGEN_CPU_TABLE *);
@@ -1355,8 +1360,11 @@ m32r_cgen_rebuild_tables (CGEN_CPU_TABLE *cd)
 	{
 	  if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
 	    {
-	      fprintf (stderr, "m32r_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\n",
-		       cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
+	      opcodes_error_handler
+		(/* xgettext:c-format */
+		 _("internal error: m32r_cgen_rebuild_tables: "
+		   "conflicting insn-chunk-bitsize values: `%d' vs. `%d'"),
+		 cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
 	      abort ();
 	    }
 
@@ -1435,8 +1443,11 @@ m32r_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
 	  endian = va_arg (ap, enum cgen_endian);
 	  break;
 	default :
-	  fprintf (stderr, "m32r_cgen_cpu_open: unsupported argument `%d'\n",
-		   arg_type);
+	  opcodes_error_handler
+	    (/* xgettext:c-format */
+	     _("internal error: m32r_cgen_cpu_open: "
+	       "unsupported argument `%d'"),
+	     arg_type);
 	  abort (); /* ??? return NULL? */
 	}
       arg_type = va_arg (ap, enum cgen_cpu_open_arg);
@@ -1451,7 +1462,9 @@ m32r_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
   if (endian == CGEN_ENDIAN_UNKNOWN)
     {
       /* ??? If target has only one, could have a default.  */
-      fprintf (stderr, "m32r_cgen_cpu_open: no endianness specified\n");
+      opcodes_error_handler
+	(/* xgettext:c-format */
+	 _("internal error: m32r_cgen_cpu_open: no endianness specified"));
       abort ();
     }
 
diff --git a/opcodes/m32r-dis.c b/opcodes/m32r-dis.c
index fda3333..cd3349c 100644
--- a/opcodes/m32r-dis.c
+++ b/opcodes/m32r-dis.c
@@ -276,9 +276,10 @@ m32r_cgen_print_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while printing insn.\n"),
-	       opindex);
-    abort ();
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while printing insn"),
+	 opindex);
+      abort ();
   }
 }
 
diff --git a/opcodes/m32r-ibld.c b/opcodes/m32r-ibld.c
index ec72173..a6e6d51 100644
--- a/opcodes/m32r-ibld.c
+++ b/opcodes/m32r-ibld.c
@@ -666,8 +666,9 @@ m32r_cgen_insert_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while building insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while building insn"),
+	 opindex);
       abort ();
   }
 
@@ -803,8 +804,9 @@ m32r_cgen_extract_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while decoding insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while decoding insn"),
+	 opindex);
       abort ();
     }
 
@@ -916,8 +918,9 @@ m32r_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting int operand"),
+	 opindex);
       abort ();
   }
 
@@ -1011,8 +1014,9 @@ m32r_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting vma operand"),
+	 opindex);
       abort ();
   }
 
@@ -1112,8 +1116,9 @@ m32r_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting int operand"),
+	 opindex);
       abort ();
   }
 }
@@ -1203,8 +1208,9 @@ m32r_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting vma operand"),
+	 opindex);
       abort ();
   }
 }
diff --git a/opcodes/mep-asm.c b/opcodes/mep-asm.c
index 45405d6..09e747a 100644
--- a/opcodes/mep-asm.c
+++ b/opcodes/mep-asm.c
@@ -1284,7 +1284,9 @@ mep_cgen_parse_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while parsing.\n"), opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while parsing"),
+	 opindex);
       abort ();
   }
 
diff --git a/opcodes/mep-desc.c b/opcodes/mep-desc.c
index da6f20e..62463bd 100644
--- a/opcodes/mep-desc.c
+++ b/opcodes/mep-desc.c
@@ -6056,6 +6056,11 @@ init_tables (void)
 {
 }
 
+#ifndef opcodes_error_handler
+#define opcodes_error_handler(...) \
+  fprintf (stderr, __VA_ARGS__); fputc ('\n', stderr)
+#endif
+
 static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *);
 static void build_hw_table      (CGEN_CPU_TABLE *);
 static void build_ifield_table  (CGEN_CPU_TABLE *);
@@ -6216,8 +6221,11 @@ mep_cgen_rebuild_tables (CGEN_CPU_TABLE *cd)
 	{
 	  if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
 	    {
-	      fprintf (stderr, "mep_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\n",
-		       cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
+	      opcodes_error_handler
+		(/* xgettext:c-format */
+		 _("internal error: mep_cgen_rebuild_tables: "
+		   "conflicting insn-chunk-bitsize values: `%d' vs. `%d'"),
+		 cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
 	      abort ();
 	    }
 
@@ -6296,8 +6304,11 @@ mep_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
 	  endian = va_arg (ap, enum cgen_endian);
 	  break;
 	default :
-	  fprintf (stderr, "mep_cgen_cpu_open: unsupported argument `%d'\n",
-		   arg_type);
+	  opcodes_error_handler
+	    (/* xgettext:c-format */
+	     _("internal error: mep_cgen_cpu_open: "
+	       "unsupported argument `%d'"),
+	     arg_type);
 	  abort (); /* ??? return NULL? */
 	}
       arg_type = va_arg (ap, enum cgen_cpu_open_arg);
@@ -6312,7 +6323,9 @@ mep_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
   if (endian == CGEN_ENDIAN_UNKNOWN)
     {
       /* ??? If target has only one, could have a default.  */
-      fprintf (stderr, "mep_cgen_cpu_open: no endianness specified\n");
+      opcodes_error_handler
+	(/* xgettext:c-format */
+	 _("internal error: mep_cgen_cpu_open: no endianness specified"));
       abort ();
     }
 
diff --git a/opcodes/mep-dis.c b/opcodes/mep-dis.c
index b736274..e52db1e 100644
--- a/opcodes/mep-dis.c
+++ b/opcodes/mep-dis.c
@@ -1184,9 +1184,10 @@ mep_cgen_print_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while printing insn.\n"),
-	       opindex);
-    abort ();
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while printing insn"),
+	 opindex);
+      abort ();
   }
 }
 
diff --git a/opcodes/mep-ibld.c b/opcodes/mep-ibld.c
index d18cf07..077e560 100644
--- a/opcodes/mep-ibld.c
+++ b/opcodes/mep-ibld.c
@@ -1209,8 +1209,9 @@ mep_cgen_insert_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while building insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while building insn"),
+	 opindex);
       abort ();
   }
 
@@ -1808,8 +1809,9 @@ mep_cgen_extract_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while decoding insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while decoding insn"),
+	 opindex);
       abort ();
     }
 
@@ -2278,8 +2280,9 @@ mep_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting int operand"),
+	 opindex);
       abort ();
   }
 
@@ -2730,8 +2733,9 @@ mep_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting vma operand"),
+	 opindex);
       abort ();
   }
 
@@ -3143,8 +3147,9 @@ mep_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting int operand"),
+	 opindex);
       abort ();
   }
 }
@@ -3546,8 +3551,9 @@ mep_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting vma operand"),
+	 opindex);
       abort ();
   }
 }
diff --git a/opcodes/mmix-dis.c b/opcodes/mmix-dis.c
index bf14b77..89a4cd9 100644
--- a/opcodes/mmix-dis.c
+++ b/opcodes/mmix-dis.c
@@ -27,24 +27,23 @@
 #include "bfd.h"
 #include "opintl.h"
 
-#define BAD_CASE(x)				\
- do						\
-   {						\
-     fprintf (stderr,				\
-	      _("Bad case %d (%s) in %s:%d\n"),	\
-	      x, #x, __FILE__, __LINE__);	\
-     abort ();					\
-   }						\
+#define BAD_CASE(x)						\
+  do								\
+   {								\
+     opcodes_error_handler (_("bad case %d (%s) in %s:%d"),	\
+			    x, #x, __FILE__, __LINE__);		\
+     abort ();							\
+   }								\
  while (0)
 
-#define FATAL_DEBUG							\
- do									\
-   {									\
-     fprintf (stderr,							\
-	      _("Internal: Non-debugged code (test-case missing): %s:%d"),\
-	      __FILE__, __LINE__);					\
-     abort ();								\
-   }									\
+#define FATAL_DEBUG						\
+ do								\
+   {								\
+     opcodes_error_handler (_("internal: non-debugged code "	\
+			      "(test-case missing): %s:%d"),	\
+			    __FILE__, __LINE__);		\
+     abort ();							\
+   }								\
  while (0)
 
 #define ROUND_MODE(n)					\
diff --git a/opcodes/msp430-decode.c b/opcodes/msp430-decode.c
index 54ee999..eb10116 100644
--- a/opcodes/msp430-decode.c
+++ b/opcodes/msp430-decode.c
@@ -1,3 +1,4 @@
+/* DO NOT EDIT!  -*- buffer-read-only: t -*- vi:set ro:  */
 #line 1 "msp430-decode.opc"
 /* -*- c -*- */
 /* Copyright (C) 2013-2018 Free Software Foundation, Inc.
@@ -26,6 +27,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "ansidecl.h"
+#include "opintl.h"
 #include "opcode/msp430-decode.h"
 
 static int trace = 0;
@@ -141,9 +143,9 @@ immediate (int bytes, int sign_extend, LocalData *ld)
 	i -= 0x100000000ULL;
       break;
     default:
-      fprintf (stderr,
-	       "Programmer error: immediate() called with invalid byte count %d\n",
-	       bytes);
+      opcodes_error_handler
+	(_("internal error: immediate() called with invalid byte count %d"),
+	   bytes);
       abort ();
     }
   return i;
@@ -359,9 +361,9 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_1:
               {
                 /** 0000 srcr 0000 dstr		MOVA @%1, %0 */
-#line 439 "msp430-decode.opc"
+#line 440 "msp430-decode.opc"
                 int srcr AU = op[0] & 0x0f;
-#line 439 "msp430-decode.opc"
+#line 440 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -372,7 +374,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("MOVA @%1, %0");
-#line 439 "msp430-decode.opc"
+#line 440 "msp430-decode.opc"
                 ID (MSO_mov); SM (srcr, 0); DR (dstr);
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -383,9 +385,9 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_2:
               {
                 /** 0000 srcr 0001 dstr		MOVA @%1+, %0 */
-#line 444 "msp430-decode.opc"
+#line 445 "msp430-decode.opc"
                 int srcr AU = op[0] & 0x0f;
-#line 444 "msp430-decode.opc"
+#line 445 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -396,7 +398,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("MOVA @%1+, %0");
-#line 444 "msp430-decode.opc"
+#line 445 "msp430-decode.opc"
                 ID (MSO_mov); SI (srcr); DR (dstr);
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -407,9 +409,9 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_3:
               {
                 /** 0000 srcr 0010 dstr		MOVA &%1, %0 */
-#line 449 "msp430-decode.opc"
+#line 450 "msp430-decode.opc"
                 int srcr AU = op[0] & 0x0f;
-#line 449 "msp430-decode.opc"
+#line 450 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -420,7 +422,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("MOVA &%1, %0");
-#line 449 "msp430-decode.opc"
+#line 450 "msp430-decode.opc"
                 ID (MSO_mov); SA ((srcr << 16) + IMMU(2)); DR (dstr);
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -431,9 +433,9 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_4:
               {
                 /** 0000 srcr 0011 dstr		MOVA %1, %0 */
-#line 454 "msp430-decode.opc"
+#line 455 "msp430-decode.opc"
                 int srcr AU = op[0] & 0x0f;
-#line 454 "msp430-decode.opc"
+#line 455 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -444,7 +446,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("MOVA %1, %0");
-#line 454 "msp430-decode.opc"
+#line 455 "msp430-decode.opc"
                 ID (MSO_mov); SM (srcr, IMMS(2)); DR (dstr);
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -456,11 +458,11 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_5:
               {
                 /** 0000 bt00 010w dstr		RRCM.A %c, %0 */
-#line 521 "msp430-decode.opc"
+#line 522 "msp430-decode.opc"
                 int bt AU = (op[0] >> 2) & 0x03;
-#line 521 "msp430-decode.opc"
+#line 522 "msp430-decode.opc"
                 int w AU = (op[1] >> 4) & 0x01;
-#line 521 "msp430-decode.opc"
+#line 522 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -472,7 +474,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("RRCM.A %c, %0");
-#line 521 "msp430-decode.opc"
+#line 522 "msp430-decode.opc"
                 ID (MSO_rrc); DR (dstr); SR (dstr);
                 msp430->repeats = bt;
                 msp430->size = w ? 16 : 20;
@@ -485,9 +487,9 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_6:
               {
                 /** 0000 srcr 0110 dstr		MOVA %1, &%0 */
-#line 459 "msp430-decode.opc"
+#line 460 "msp430-decode.opc"
                 int srcr AU = op[0] & 0x0f;
-#line 459 "msp430-decode.opc"
+#line 460 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -498,7 +500,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("MOVA %1, &%0");
-#line 459 "msp430-decode.opc"
+#line 460 "msp430-decode.opc"
                 ID (MSO_mov); SR (srcr); DA ((dstr << 16) + IMMU(2));
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -509,9 +511,9 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_7:
               {
                 /** 0000 srcr 0111 dstr		MOVA %1, &%0 */
-#line 464 "msp430-decode.opc"
+#line 465 "msp430-decode.opc"
                 int srcr AU = op[0] & 0x0f;
-#line 464 "msp430-decode.opc"
+#line 465 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -522,7 +524,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("MOVA %1, &%0");
-#line 464 "msp430-decode.opc"
+#line 465 "msp430-decode.opc"
                 ID (MSO_mov); SR (srcr); DM (dstr, IMMS(2));
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -533,9 +535,9 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_8:
               {
                 /** 0000 srcr 1000 dstr		MOVA %1, %0 */
-#line 469 "msp430-decode.opc"
+#line 470 "msp430-decode.opc"
                 int srcr AU = op[0] & 0x0f;
-#line 469 "msp430-decode.opc"
+#line 470 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -546,7 +548,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("MOVA %1, %0");
-#line 469 "msp430-decode.opc"
+#line 470 "msp430-decode.opc"
                 ID (MSO_mov); SC ((srcr << 16) + IMMU(2)); DR (dstr);
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -557,9 +559,9 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_9:
               {
                 /** 0000 srcr 1001 dstr		CMPA %1, %0 */
-#line 474 "msp430-decode.opc"
+#line 475 "msp430-decode.opc"
                 int srcr AU = op[0] & 0x0f;
-#line 474 "msp430-decode.opc"
+#line 475 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -570,7 +572,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("CMPA %1, %0");
-#line 474 "msp430-decode.opc"
+#line 475 "msp430-decode.opc"
                 ID (MSO_cmp); SC ((srcr << 16) + IMMU(2)); DR (dstr);
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -582,9 +584,9 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_10:
               {
                 /** 0000 srcr 1010 dstr		ADDA %1, %0 */
-#line 480 "msp430-decode.opc"
+#line 481 "msp430-decode.opc"
                 int srcr AU = op[0] & 0x0f;
-#line 480 "msp430-decode.opc"
+#line 481 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -595,7 +597,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("ADDA %1, %0");
-#line 480 "msp430-decode.opc"
+#line 481 "msp430-decode.opc"
                 ID (MSO_add); SC ((srcr << 16) + IMMU(2)); DR (dstr);
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -607,9 +609,9 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_11:
               {
                 /** 0000 srcr 1011 dstr		SUBA %1, %0 */
-#line 486 "msp430-decode.opc"
+#line 487 "msp430-decode.opc"
                 int srcr AU = op[0] & 0x0f;
-#line 486 "msp430-decode.opc"
+#line 487 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -620,7 +622,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("SUBA %1, %0");
-#line 486 "msp430-decode.opc"
+#line 487 "msp430-decode.opc"
                 ID (MSO_sub); SC ((srcr << 16) + IMMU(2)); DR (dstr);
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -632,9 +634,9 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_12:
               {
                 /** 0000 srcr 1100 dstr		MOVA %1, %0 */
-#line 498 "msp430-decode.opc"
+#line 499 "msp430-decode.opc"
                 int srcr AU = op[0] & 0x0f;
-#line 498 "msp430-decode.opc"
+#line 499 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -645,7 +647,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("MOVA %1, %0");
-#line 498 "msp430-decode.opc"
+#line 499 "msp430-decode.opc"
                 ID (MSO_mov); SR (srcr); DR (dstr);
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -656,9 +658,9 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_13:
               {
                 /** 0000 srcr 1101 dstr		CMPA %1, %0 */
-#line 503 "msp430-decode.opc"
+#line 504 "msp430-decode.opc"
                 int srcr AU = op[0] & 0x0f;
-#line 503 "msp430-decode.opc"
+#line 504 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -669,7 +671,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("CMPA %1, %0");
-#line 503 "msp430-decode.opc"
+#line 504 "msp430-decode.opc"
                 ID (MSO_cmp); SR (srcr); DR (dstr);
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -681,9 +683,9 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_14:
               {
                 /** 0000 srcr 1110 dstr		ADDA %1, %0 */
-#line 509 "msp430-decode.opc"
+#line 510 "msp430-decode.opc"
                 int srcr AU = op[0] & 0x0f;
-#line 509 "msp430-decode.opc"
+#line 510 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -694,7 +696,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("ADDA %1, %0");
-#line 509 "msp430-decode.opc"
+#line 510 "msp430-decode.opc"
                 ID (MSO_add); SR (srcr); DR (dstr);
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -706,9 +708,9 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_15:
               {
                 /** 0000 srcr 1111 dstr		SUBA %1, %0 */
-#line 515 "msp430-decode.opc"
+#line 516 "msp430-decode.opc"
                 int srcr AU = op[0] & 0x0f;
-#line 515 "msp430-decode.opc"
+#line 516 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -719,7 +721,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("SUBA %1, %0");
-#line 515 "msp430-decode.opc"
+#line 516 "msp430-decode.opc"
                 ID (MSO_sub); SR (srcr); DR (dstr);
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -750,11 +752,11 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_16:
               {
                 /** 0000 bt01 010w dstr		RRAM.A %c, %0 */
-#line 528 "msp430-decode.opc"
+#line 529 "msp430-decode.opc"
                 int bt AU = (op[0] >> 2) & 0x03;
-#line 528 "msp430-decode.opc"
+#line 529 "msp430-decode.opc"
                 int w AU = (op[1] >> 4) & 0x01;
-#line 528 "msp430-decode.opc"
+#line 529 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -766,7 +768,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("RRAM.A %c, %0");
-#line 528 "msp430-decode.opc"
+#line 529 "msp430-decode.opc"
                 ID (MSO_rra); DR (dstr); SR (dstr);
                 msp430->repeats = bt;
                 msp430->size = w ? 16 : 20;
@@ -828,11 +830,11 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_17:
               {
                 /** 0000 bt10 010w dstr		RLAM.A %c, %0 */
-#line 535 "msp430-decode.opc"
+#line 536 "msp430-decode.opc"
                 int bt AU = (op[0] >> 2) & 0x03;
-#line 535 "msp430-decode.opc"
+#line 536 "msp430-decode.opc"
                 int w AU = (op[1] >> 4) & 0x01;
-#line 535 "msp430-decode.opc"
+#line 536 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -844,7 +846,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("RLAM.A %c, %0");
-#line 535 "msp430-decode.opc"
+#line 536 "msp430-decode.opc"
                 ID (MSO_add); DR (dstr); SR (dstr);
                 msp430->repeats = bt;
                 msp430->size = w ? 16 : 20;
@@ -906,11 +908,11 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_18:
               {
                 /** 0000 bt11 010w dstr		RRUM.A %c, %0 */
-#line 542 "msp430-decode.opc"
+#line 543 "msp430-decode.opc"
                 int bt AU = (op[0] >> 2) & 0x03;
-#line 542 "msp430-decode.opc"
+#line 543 "msp430-decode.opc"
                 int w AU = (op[1] >> 4) & 0x01;
-#line 542 "msp430-decode.opc"
+#line 543 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -922,7 +924,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("RRUM.A %c, %0");
-#line 542 "msp430-decode.opc"
+#line 543 "msp430-decode.opc"
                 ID (MSO_rru); DR (dstr); SR (dstr);
                 msp430->repeats = bt;
                 msp430->size = w ? 16 : 20;
@@ -1595,15 +1597,15 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_19:
               {
                 /** 0001 00so c b ad dreg	%S%b	%1				*/
-#line 395 "msp430-decode.opc"
+#line 396 "msp430-decode.opc"
                 int so AU = op[0] & 0x03;
-#line 395 "msp430-decode.opc"
+#line 396 "msp430-decode.opc"
                 int c AU = (op[1] >> 7) & 0x01;
-#line 395 "msp430-decode.opc"
+#line 396 "msp430-decode.opc"
                 int b AU = (op[1] >> 6) & 0x01;
-#line 395 "msp430-decode.opc"
+#line 396 "msp430-decode.opc"
                 int ad AU = (op[1] >> 4) & 0x03;
-#line 395 "msp430-decode.opc"
+#line 396 "msp430-decode.opc"
                 int dreg AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -1617,7 +1619,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dreg = 0x%x\n", dreg);
                   }
                 SYNTAX("%S%b	%1");
-#line 395 "msp430-decode.opc"
+#line 396 "msp430-decode.opc"
 
                 ID (sopc_to_id (so,c)); ASX (dreg, ad, srxt_bits); ABW (al_bit, b);
 
@@ -1683,7 +1685,7 @@ msp430_decode_opcode (unsigned long pc,
                            op[0], op[1]);
                   }
                 SYNTAX("RETI");
-#line 549 "msp430-decode.opc"
+#line 550 "msp430-decode.opc"
                 ID (MSO_reti);
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -1901,9 +1903,9 @@ msp430_decode_opcode (unsigned long pc,
           case 0x7f:
               {
                 /** 0001 0011 01as dstr		CALLA %0 */
-#line 554 "msp430-decode.opc"
+#line 555 "msp430-decode.opc"
                 int as AU = (op[1] >> 4) & 0x03;
-#line 554 "msp430-decode.opc"
+#line 555 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -1914,7 +1916,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("CALLA %0");
-#line 554 "msp430-decode.opc"
+#line 555 "msp430-decode.opc"
                 ID (MSO_call); AS (dstr, as);
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -1939,7 +1941,7 @@ msp430_decode_opcode (unsigned long pc,
           case 0x8f:
               {
                 /** 0001 0011 1000 extb		CALLA %0 */
-#line 559 "msp430-decode.opc"
+#line 560 "msp430-decode.opc"
                 int extb AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -1949,7 +1951,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  extb = 0x%x\n", extb);
                   }
                 SYNTAX("CALLA %0");
-#line 559 "msp430-decode.opc"
+#line 560 "msp430-decode.opc"
                 ID (MSO_call); SA (IMMU(2) | (extb << 16));
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -1974,7 +1976,7 @@ msp430_decode_opcode (unsigned long pc,
           case 0x9f:
               {
                 /** 0001 0011 1001 extb		CALLA %0 */
-#line 564 "msp430-decode.opc"
+#line 565 "msp430-decode.opc"
                 int extb AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -1984,7 +1986,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  extb = 0x%x\n", extb);
                   }
                 SYNTAX("CALLA %0");
-#line 564 "msp430-decode.opc"
+#line 565 "msp430-decode.opc"
                 raddr = IMMU(2) | (extb << 16);
                 if (raddr & 0x80000)
                   raddr -= 0x100000;
@@ -2012,7 +2014,7 @@ msp430_decode_opcode (unsigned long pc,
           case 0xbf:
               {
                 /** 0001 0011 1011 extb		CALLA %0 */
-#line 572 "msp430-decode.opc"
+#line 573 "msp430-decode.opc"
                 int extb AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -2022,7 +2024,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  extb = 0x%x\n", extb);
                   }
                 SYNTAX("CALLA %0");
-#line 572 "msp430-decode.opc"
+#line 573 "msp430-decode.opc"
                 ID (MSO_call); SC (IMMU(2) | (extb << 16));
                 msp430->size = 20;
                 msp430->ofs_430x = 1;
@@ -2039,11 +2041,11 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_20:
               {
                 /** 0001 010w bits srcr		PUSHM.A %0 */
-#line 577 "msp430-decode.opc"
+#line 578 "msp430-decode.opc"
                 int w AU = op[0] & 0x01;
-#line 577 "msp430-decode.opc"
+#line 578 "msp430-decode.opc"
                 int bits AU = (op[1] >> 4) & 0x0f;
-#line 577 "msp430-decode.opc"
+#line 578 "msp430-decode.opc"
                 int srcr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -2055,7 +2057,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  srcr = 0x%x\n", srcr);
                   }
                 SYNTAX("PUSHM.A %0");
-#line 577 "msp430-decode.opc"
+#line 578 "msp430-decode.opc"
                 ID (MSO_push); SR (srcr);
                 msp430->size = w ? 16 : 20;
                 msp430->repeats = bits;
@@ -2082,11 +2084,11 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_21:
               {
                 /** 0001 011w bits dstr		POPM.A %0 */
-#line 583 "msp430-decode.opc"
+#line 584 "msp430-decode.opc"
                 int w AU = op[0] & 0x01;
-#line 583 "msp430-decode.opc"
+#line 584 "msp430-decode.opc"
                 int bits AU = (op[1] >> 4) & 0x0f;
-#line 583 "msp430-decode.opc"
+#line 584 "msp430-decode.opc"
                 int dstr AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -2098,7 +2100,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dstr = 0x%x\n", dstr);
                   }
                 SYNTAX("POPM.A %0");
-#line 583 "msp430-decode.opc"
+#line 584 "msp430-decode.opc"
                 ID (MSO_pop); DR (dstr);
                 msp430->size = w ? 16 : 20;
                 msp430->repeats = bits;
@@ -2125,13 +2127,13 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_22:
               {
                 /** 0001 1srx t l 00 dsxt 	430x */
-#line 351 "msp430-decode.opc"
+#line 352 "msp430-decode.opc"
                 int srx AU = op[0] & 0x07;
-#line 351 "msp430-decode.opc"
+#line 352 "msp430-decode.opc"
                 int t AU = (op[1] >> 7) & 0x01;
-#line 351 "msp430-decode.opc"
+#line 352 "msp430-decode.opc"
                 int l AU = (op[1] >> 6) & 0x01;
-#line 351 "msp430-decode.opc"
+#line 352 "msp430-decode.opc"
                 int dsxt AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -2144,7 +2146,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dsxt = 0x%x\n", dsxt);
                   }
                 SYNTAX("430x");
-#line 351 "msp430-decode.opc"
+#line 352 "msp430-decode.opc"
 
                 al_bit = l;
                 srxt_bits = srx * 2 + t;
@@ -2247,11 +2249,11 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_23:
               {
                 /** 001jmp aa addrlsbs		%J	%1				*/
-#line 425 "msp430-decode.opc"
+#line 426 "msp430-decode.opc"
                 int jmp AU = (op[0] >> 2) & 0x07;
-#line 425 "msp430-decode.opc"
+#line 426 "msp430-decode.opc"
                 int aa AU = op[0] & 0x03;
-#line 425 "msp430-decode.opc"
+#line 426 "msp430-decode.opc"
                 int addrlsbs AU = op[1];
                 if (trace)
                   {
@@ -2263,7 +2265,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  addrlsbs = 0x%x\n", addrlsbs);
                   }
                 SYNTAX("%J	%1");
-#line 425 "msp430-decode.opc"
+#line 426 "msp430-decode.opc"
 
                 raddr = (aa << 9) | (addrlsbs << 1);
                 if (raddr & 0x400)
@@ -2568,17 +2570,17 @@ msp430_decode_opcode (unsigned long pc,
             op_semantics_24:
               {
                 /** dopc sreg a b as dreg	%D%b	%1,%0				*/
-#line 372 "msp430-decode.opc"
+#line 373 "msp430-decode.opc"
                 int dopc AU = (op[0] >> 4) & 0x0f;
-#line 372 "msp430-decode.opc"
+#line 373 "msp430-decode.opc"
                 int sreg AU = op[0] & 0x0f;
-#line 372 "msp430-decode.opc"
+#line 373 "msp430-decode.opc"
                 int a AU = (op[1] >> 7) & 0x01;
-#line 372 "msp430-decode.opc"
+#line 373 "msp430-decode.opc"
                 int b AU = (op[1] >> 6) & 0x01;
-#line 372 "msp430-decode.opc"
+#line 373 "msp430-decode.opc"
                 int as AU = (op[1] >> 4) & 0x03;
-#line 372 "msp430-decode.opc"
+#line 373 "msp430-decode.opc"
                 int dreg AU = op[1] & 0x0f;
                 if (trace)
                   {
@@ -2593,7 +2595,7 @@ msp430_decode_opcode (unsigned long pc,
                     printf ("  dreg = 0x%x\n", dreg);
                   }
                 SYNTAX("%D%b	%1,%0");
-#line 372 "msp430-decode.opc"
+#line 373 "msp430-decode.opc"
 
                 ID (dopc_to_id (dopc)); ASX (sreg, as, srxt_bits); ADX (dreg, a, dsxt_bits); ABW (al_bit, b);
                 if (a == 0 && as == 0)
@@ -4340,7 +4342,7 @@ msp430_decode_opcode (unsigned long pc,
         }
       break;
   }
-#line 589 "msp430-decode.opc"
+#line 590 "msp430-decode.opc"
 
   return msp430->n_bytes;
 }
diff --git a/opcodes/msp430-decode.opc b/opcodes/msp430-decode.opc
index 5afd3f3..8cdae5a 100644
--- a/opcodes/msp430-decode.opc
+++ b/opcodes/msp430-decode.opc
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "ansidecl.h"
+#include "opintl.h"
 #include "opcode/msp430-decode.h"
 
 static int trace = 0;
@@ -140,9 +141,9 @@ immediate (int bytes, int sign_extend, LocalData *ld)
 	i -= 0x100000000ULL;
       break;
     default:
-      fprintf (stderr,
-	       "Programmer error: immediate() called with invalid byte count %d\n",
-	       bytes);
+      opcodes_error_handler
+	(_("internal error: immediate() called with invalid byte count %d"),
+	   bytes);
       abort ();
     }
   return i;
diff --git a/opcodes/mt-asm.c b/opcodes/mt-asm.c
index 31cc178..cfab162 100644
--- a/opcodes/mt-asm.c
+++ b/opcodes/mt-asm.c
@@ -592,7 +592,9 @@ mt_cgen_parse_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while parsing.\n"), opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while parsing"),
+	 opindex);
       abort ();
   }
 
diff --git a/opcodes/mt-desc.c b/opcodes/mt-desc.c
index 0ce481b..d2f447f 100644
--- a/opcodes/mt-desc.c
+++ b/opcodes/mt-desc.c
@@ -976,6 +976,11 @@ init_tables (void)
 {
 }
 
+#ifndef opcodes_error_handler
+#define opcodes_error_handler(...) \
+  fprintf (stderr, __VA_ARGS__); fputc ('\n', stderr)
+#endif
+
 static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *);
 static void build_hw_table      (CGEN_CPU_TABLE *);
 static void build_ifield_table  (CGEN_CPU_TABLE *);
@@ -1136,8 +1141,11 @@ mt_cgen_rebuild_tables (CGEN_CPU_TABLE *cd)
 	{
 	  if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
 	    {
-	      fprintf (stderr, "mt_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\n",
-		       cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
+	      opcodes_error_handler
+		(/* xgettext:c-format */
+		 _("internal error: mt_cgen_rebuild_tables: "
+		   "conflicting insn-chunk-bitsize values: `%d' vs. `%d'"),
+		 cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
 	      abort ();
 	    }
 
@@ -1216,8 +1224,11 @@ mt_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
 	  endian = va_arg (ap, enum cgen_endian);
 	  break;
 	default :
-	  fprintf (stderr, "mt_cgen_cpu_open: unsupported argument `%d'\n",
-		   arg_type);
+	  opcodes_error_handler
+	    (/* xgettext:c-format */
+	     _("internal error: mt_cgen_cpu_open: "
+	       "unsupported argument `%d'"),
+	     arg_type);
 	  abort (); /* ??? return NULL? */
 	}
       arg_type = va_arg (ap, enum cgen_cpu_open_arg);
@@ -1232,7 +1243,9 @@ mt_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
   if (endian == CGEN_ENDIAN_UNKNOWN)
     {
       /* ??? If target has only one, could have a default.  */
-      fprintf (stderr, "mt_cgen_cpu_open: no endianness specified\n");
+      opcodes_error_handler
+	(/* xgettext:c-format */
+	 _("internal error: mt_cgen_cpu_open: no endianness specified"));
       abort ();
     }
 
diff --git a/opcodes/mt-dis.c b/opcodes/mt-dis.c
index 3b39b84..9b6df6a 100644
--- a/opcodes/mt-dis.c
+++ b/opcodes/mt-dis.c
@@ -287,9 +287,10 @@ mt_cgen_print_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while printing insn.\n"),
-	       opindex);
-    abort ();
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while printing insn"),
+	 opindex);
+      abort ();
   }
 }
 
diff --git a/opcodes/mt-ibld.c b/opcodes/mt-ibld.c
index 9f5cfff..4e8ed89 100644
--- a/opcodes/mt-ibld.c
+++ b/opcodes/mt-ibld.c
@@ -750,8 +750,9 @@ mt_cgen_insert_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while building insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while building insn"),
+	 opindex);
       abort ();
   }
 
@@ -970,8 +971,9 @@ mt_cgen_extract_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while decoding insn.\n"),
-	       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while decoding insn"),
+	 opindex);
       abort ();
     }
 
@@ -1170,8 +1172,9 @@ mt_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting int operand"),
+	 opindex);
       abort ();
   }
 
@@ -1352,8 +1355,9 @@ mt_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while getting vma operand"),
+	 opindex);
       abort ();
   }
 
@@ -1541,8 +1545,9 @@ mt_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting int operand"),
+	 opindex);
       abort ();
   }
 }
@@ -1720,8 +1725,9 @@ mt_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),
-		       opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while setting vma operand"),
+	 opindex);
       abort ();
   }
 }
diff --git a/opcodes/nds32-asm.c b/opcodes/nds32-asm.c
index c483dce..b5309fb 100644
--- a/opcodes/nds32-asm.c
+++ b/opcodes/nds32-asm.c
@@ -20,17 +20,16 @@
    02110-1301, USA.  */
 
 
-#include <config.h>
+#include "sysdep.h"
 
-#include <stdlib.h>
 #include <stdint.h>
-#include <string.h>
 #include <assert.h>
 
 #include "safe-ctype.h"
 #include "libiberty.h"
 #include "hashtab.h"
 #include "bfd.h"
+#include "opintl.h"
 
 #include "opcode/nds32.h"
 #include "nds32-asm.h"
@@ -1505,9 +1504,11 @@ build_opcode_syntax (struct nds32_opcode *opc)
 
       if (fd == NULL)
 	{
-	  fprintf (stderr, "Internal error: Unknown operand, %s\n", str);
+	  /* xgettext: c-format */
+	  opcodes_error_handler (_("internal error: unknown operand, %s"), str);
+	  abort ();
 	}
-      assert (fd && fidx >= 0 && fidx < (int) ARRAY_SIZE (operand_fields));
+      assert (fidx >= 0 && fidx < (int) ARRAY_SIZE (operand_fields));
       *plex |= LEX_SET_FIELD (fidx);
 
       str += len;
@@ -2057,14 +2058,16 @@ parse_operand (nds32_asm_desc_t *pdesc, nds32_asm_insn_t *pinsn,
 	    value = value & 0xfffff;
 	  break;
 	default:
-	  fprintf (stderr, "Internal error: Don't know how to handle "
-		   "parsing results.\n");
+	  /* xgettext: c-format */
+	  opcodes_error_handler (_("internal error: don't know how to handle "
+				   "parsing results"));
 	  abort ();
 	}
     }
   else
     {
-      fprintf (stderr, "Internal error: Unknown hardware resource.\n");
+      /* xgettext: c-format */
+      opcodes_error_handler (_("internal error: unknown hardware resource"));
       abort ();
     }
 
diff --git a/opcodes/nios2-dis.c b/opcodes/nios2-dis.c
index 9eedbf9..257e5bb 100644
--- a/opcodes/nios2-dis.c
+++ b/opcodes/nios2-dis.c
@@ -22,6 +22,7 @@
 
 #include "sysdep.h"
 #include "disassemble.h"
+#include "opintl.h"
 #include "opcode/nios2.h"
 #include "libiberty.h"
 #include <string.h>
@@ -130,9 +131,9 @@ nios2_init_opcode_hash (nios2_disassembler_state *state)
 	      (nios2_opcode_hash *) malloc (sizeof (nios2_opcode_hash));
 	    if (new_hash == NULL)
 	      {
-		fprintf (stderr,
-			 "error allocating memory...broken disassembler\n");
-		abort ();
+		/* xgettext:c-format */
+		opcodes_error_handler (_("out of memory"));
+		exit (1);
 	      }
 	    new_hash->opcode = op;
 	    new_hash->next = NULL;
@@ -257,8 +258,10 @@ nios2_control_regs (void)
 static void
 bad_opcode (const struct nios2_opcode *op)
 {
-  fprintf (stderr, "Internal error: broken opcode descriptor for `%s %s'\n",
-	   op->name, op->args);
+  opcodes_error_handler
+    /* xgettext:c-format */
+    (_("internal error: broken opcode descriptor for `%s %s'"),
+     op->name, op->args);
   abort ();
 }
 
diff --git a/opcodes/opc2c.c b/opcodes/opc2c.c
index 8a2c7f3..1184599 100644
--- a/opcodes/opc2c.c
+++ b/opcodes/opc2c.c
@@ -577,14 +577,6 @@ main (int argc, char ** argv)
   VaryRef * vlist;
   int skipping_section = 0;
 
-  if (argc > 2 && strcmp (argv[1], "-l") == 0)
-    {
-      sim_log = fopen (argv[2], "w");
-      fprintf (stderr, "sim_log: %s\n", argv[2]);
-      argc -= 2;
-      argv += 2;
-    }
-
   if (argc < 2)
     {
       fprintf (stderr, "usage: opc2c infile.opc > outfile.opc\n");
@@ -802,6 +794,8 @@ main (int argc, char ** argv)
       store_opcode_bits (opcodes[i], 0, indirect);
     }
 
+  printf ("/* DO NOT EDIT!  -*- buffer-read-only: t -*- vi:set ro:  */\n");
+
   dump_lines (&prefix_text, 0, 0);
 
   emit_indirect (indirect, 0);
diff --git a/opcodes/or1k-asm.c b/opcodes/or1k-asm.c
index 46f2fff..3162ff3 100644
--- a/opcodes/or1k-asm.c
+++ b/opcodes/or1k-asm.c
@@ -500,7 +500,9 @@ or1k_cgen_parse_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while parsing.\n"), opindex);
+      opcodes_error_handler
+	(_("internal error: unrecognized field %d while parsing"),
+	 opindex);
       abort ();
   }
 
diff --git a/opcodes/or1k-desc.c b/opcodes/or1k-desc.c
index ee8faf4..f1c0768 100644
--- a/opcodes/or1k-desc.c
+++ b/opcodes/or1k-desc.c
@@ -1778,6 +1778,11 @@ init_tables (void)
 {
 }
 
+#ifndef opcodes_error_handler
+#define opcodes_error_handler(...) \
+  fprintf (stderr, __VA_ARGS__); fputc ('\n', stderr)
+#endif
+
 static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *);
 static void build_hw_table      (CGEN_CPU_TABLE *);
 static void build_ifield_table  (CGEN_CPU_TABLE *);
@@ -1938,8 +1943,11 @@ or1k_cgen_rebuild_tables (CGEN_CPU_TABLE *cd)
 	{
 	  if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
 	    {
-	      fprintf (stderr, "or1k_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\n",
-		       cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
+	      opcodes_error_handler
+		(/* xgettext:c-format */
+		 _("internal error: or1k_cgen_rebuild_tables: "
+		   "conflicting insn-chunk-bitsize values: `%d' vs. `%d'"),
+		 cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
 	      abort ();
 	    }
 
@@ -2018,8 +2026,11 @@ or1k_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
 	  endian = va_arg (ap, enum cgen_endian);
 	  break;
 	default :
-	  fprintf (stderr, "or1k_cgen_cpu_open: unsupported argument `%d'\n",
-		   arg_type);
+	  opcodes_error_handler
+	    (/* xgettext:c-format */
+	     _("internal error: or1k_cgen_cpu_open: "
+	       "unsupported argument `%d'"),
+	     arg_type);
 	  abort (); /* ??? return NULL? */
 	}
       arg_type = va_arg (ap, enum cgen_cpu_open_arg);
@@ -2034,7 +2045,9 @@ or1k_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
   if (endian == CGEN_ENDIAN_UNKNOWN)
     {
       /* ??? If target has only one, could have a default.  */
-      fprintf (stderr, "or1k_c[...]

[diff truncated at 100000 bytes]


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