public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] opcodes: no internationalization needed for build helper tools
@ 2023-01-20  9:29 Jan Beulich
  2023-01-20  9:30 ` [PATCH 1/2] x86: remove internationalization from i386-gen.c Jan Beulich
  2023-01-20  9:31 ` [PATCH 2/2] opcodes: suppress internationalization on build helper tools Jan Beulich
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2023-01-20  9:29 UTC (permalink / raw)
  To: Binutils; +Cc: Nick Clifton, Alan Modra

There's one open question, which I hope Nick or Alan could answer: It's
entirely unclear to me whether such adjustments are expected to be
immediately accompanied by an update of po/opcodes.pot. For now I'm
assuming that file is updated by other means / at other times.

1: x86: remove internationalization from i386-gen.c
2: opcodes: suppress internationalization on build helper tools

Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] x86: remove internationalization from i386-gen.c
  2023-01-20  9:29 [PATCH 0/2] opcodes: no internationalization needed for build helper tools Jan Beulich
@ 2023-01-20  9:30 ` Jan Beulich
  2023-01-20  9:31 ` [PATCH 2/2] opcodes: suppress internationalization on build helper tools Jan Beulich
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2023-01-20  9:30 UTC (permalink / raw)
  To: Binutils; +Cc: H.J. Lu

This is a build time helper utility, which doesn't require translation.
---
It's entirely unclear to me whether such an adjustment is expected to be
immediately accompanied by an update of po/opcodes.pot.

--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -28,9 +28,6 @@
 
 #include "i386-opc.h"
 
-#include <libintl.h>
-#define _(String) gettext (String)
-
 /* Build-time checks are preferrable over runtime ones.  Use this construct
    in preference where possible.  */
 #define static_assert(e) ((void)sizeof (struct { int _:1 - 2 * !(e); }))
@@ -557,7 +554,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);
@@ -683,9 +680,9 @@ set_bitfield (char *f, bitfield *array,
     }
 
   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
@@ -752,7 +749,7 @@ add_isa_dependencies (bitfield *flags, c
       }
 
   if (!is_isa)
-    fail (_("unknown bitfield: %s\n"), f);
+    fail ("unknown bitfield: %s\n", f);
 }
 
 static void
@@ -817,7 +814,7 @@ process_i386_cpu_flag (FILE *table, char
 	  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';
 	}
@@ -917,7 +914,7 @@ get_element_size (char **opnd, int linen
   while (full != NULL && strstr(full, "BaseIndex") == NULL)
     full = *++opnd;
   if (full == NULL)
-    fail (_("%s: %d: no memory operand\n"), filename, lineno);
+    fail ("%s: %d: no memory operand\n", filename, lineno);
 
   op = xstrdup (full);
   last = op + strlen (op);
@@ -953,7 +950,7 @@ get_element_size (char **opnd, int linen
   free (op);
 
   if (elem_size == INT_MAX)
-    fail (_("%s: %d: unknown element size: %s\n"), filename, lineno, full);
+    fail ("%s: %d: unknown element size: %s\n", filename, lineno, full);
 
   return elem_size;
 }
@@ -1010,11 +1007,11 @@ process_i386_opcode_modifier (FILE *tabl
 	  if (!modifiers[OpcodeSpace].value)
 	    modifiers[OpcodeSpace].value = space;
 	  else if (modifiers[OpcodeSpace].value != space)
-	    fail (_("%s:%d: Conflicting opcode space specifications\n"),
+	    fail ("%s:%d: Conflicting opcode space specifications\n",
 		  filename, lineno);
 	  else
 	    fprintf (stderr,
-		     _("%s:%d: Warning: redundant opcode space specification\n"),
+		     "%s:%d: Warning: redundant opcode space specification\n",
 		     filename, lineno);
 	}
 
@@ -1023,11 +1020,11 @@ process_i386_opcode_modifier (FILE *tabl
 	  if (!modifiers[OpcodePrefix].value)
 	    modifiers[OpcodePrefix].value = prefix;
 	  else if (modifiers[OpcodePrefix].value != prefix)
-	    fail (_("%s:%d: Conflicting prefix specifications\n"),
+	    fail ("%s:%d: Conflicting prefix specifications\n",
 		  filename, lineno);
 	  else
 	    fprintf (stderr,
-		     _("%s:%d: Warning: redundant prefix specification\n"),
+		     "%s:%d: Warning: redundant prefix specification\n",
 		     filename, lineno);
 	}
 
@@ -1250,13 +1247,13 @@ output_i386_opcode (FILE *table, const c
 	}
 
       if (space != SPACE_0F && --length == 1)
-	fail (_("%s:%d: %s: unrecognized opcode encoding space\n"),
+	fail ("%s:%d: %s: unrecognized opcode encoding space\n",
 	      filename, lineno, name);
       opcode &= (1ULL << (8 * --length)) - 1;
     }
 
   if (length > 2)
-    fail (_("%s:%d: %s: residual opcode (0x%0*llx) too large\n"),
+    fail ("%s:%d: %s: residual opcode (0x%0*llx) too large\n",
 	  filename, lineno, name, 2 * length, opcode);
 
   ident = mkident (name);
@@ -1648,7 +1645,7 @@ process_i386_opcodes (FILE *table)
 	  if (!j || buf[j - 1] != '+')
 	    break;
 	  if (j >= sizeof (buf) - 1)
-	    fail (_("%s: %d: (continued) line too long\n"), filename, lineno);
+	    fail ("%s: %d: (continued) line too long\n", filename, lineno);
 
 	  if (fgets (buf + j - 1, sizeof (buf) - j + 1, fp) == NULL)
 	    {
@@ -1746,7 +1743,7 @@ process_i386_opcodes (FILE *table)
 
   fp = fopen ("i386-mnem.h", "w");
   if (fp == NULL)
-    fail (_("can't create i386-mnem.h, errno = %s\n"),
+    fail ("can't create i386-mnem.h, errno = %s\n",
 	  xstrerror (errno));
 
   process_copyright (fp);
@@ -1800,7 +1797,7 @@ process_i386_registers (FILE *table)
   filename = "i386-reg.tbl";
   fp = fopen (filename, "r");
   if (fp == NULL)
-    fail (_("can't find i386-reg.tbl for reading, errno = %s\n"),
+    fail ("can't find i386-reg.tbl for reading, errno = %s\n",
 	  xstrerror (errno));
 
   fprintf (table, "\n/* i386 register table.  */\n\n");
@@ -1877,7 +1874,7 @@ process_i386_initializers (void)
   FILE *fp = fopen ("i386-init.h", "w");
 
   if (fp == NULL)
-    fail (_("can't create i386-init.h, errno = %s\n"),
+    fail ("can't create i386-init.h, errno = %s\n",
 	  xstrerror (errno));
 
   process_copyright (fp);
@@ -1992,7 +1989,7 @@ main (int argc, char **argv)
 
   if (srcdir != NULL)
     if (chdir (srcdir) != 0)
-      fail (_("unable to change directory to \"%s\", errno = %s\n"),
+      fail ("unable to change directory to \"%s\", errno = %s\n",
 	    srcdir, xstrerror (errno));
 
   /* cpu_flags isn't sorted by position.  */
@@ -2006,16 +2003,16 @@ main (int argc, char **argv)
   static_assert (ARRAY_SIZE (cpu_flags) == CpuMax + 2);
 
   if ((cpumax - 1) != CpuMax)
-    fail (_("CpuMax != %d!\n"), cpumax);
+    fail ("CpuMax != %d!\n", cpumax);
 #else
   static_assert (ARRAY_SIZE (cpu_flags) == CpuMax + 1);
 
   if (cpumax != CpuMax)
-    fail (_("CpuMax != %d!\n"), cpumax);
+    fail ("CpuMax != %d!\n", cpumax);
 
   c = CpuNumOfBits - CpuMax - 1;
   if (c)
-    fail (_("%d unused bits in i386_cpu_flags.\n"), c);
+    fail ("%d unused bits in i386_cpu_flags.\n", c);
 #endif
 
   static_assert (ARRAY_SIZE (opcode_modifiers) == Opcode_Modifier_Num);
@@ -2030,7 +2027,7 @@ main (int argc, char **argv)
 
   c = OTNumOfBits - OTNum;
   if (c)
-    fail (_("%d unused bits in i386_operand_type.\n"), c);
+    fail ("%d unused bits in i386_operand_type.\n", c);
 #endif
 
   qsort (cpu_flags, ARRAY_SIZE (cpu_flags), sizeof (cpu_flags [0]),
@@ -2044,7 +2041,7 @@ main (int argc, char **argv)
 
   table = fopen ("i386-tbl.h", "w");
   if (table == NULL)
-    fail (_("can't create i386-tbl.h, errno = %s\n"),
+    fail ("can't create i386-tbl.h, errno = %s\n",
 	  xstrerror (errno));
 
   process_copyright (table);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] opcodes: suppress internationalization on build helper tools
  2023-01-20  9:29 [PATCH 0/2] opcodes: no internationalization needed for build helper tools Jan Beulich
  2023-01-20  9:30 ` [PATCH 1/2] x86: remove internationalization from i386-gen.c Jan Beulich
@ 2023-01-20  9:31 ` Jan Beulich
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2023-01-20  9:31 UTC (permalink / raw)
  To: Binutils; +Cc: Nick Clifton, Alan Modra

While one of the two actually having been instrumented (i386-gen.c) now
has that instrumentation dropped, there's still no point in honoring
such instrumentation in general (i.e. now for ia64-gen.c only), as that
only leads to a waste of resources.

With CFILES then being merely an alias of LIBOPCODES_CFILES, drop the
former variable altogether.
---
Again it's entirely unclear to me whether such an adjustment is expected
to be immediately accompanied by an update of po/opcodes.pot.

--- a/opcodes/Makefile.am
+++ b/opcodes/Makefile.am
@@ -277,22 +277,6 @@ LIBOPCODES_CFILES = \
 	dis-init.c \
 	disassemble.c
 
-# C source files that correspond to .o's.
-CFILES = \
-	$(LIBOPCODES_CFILES) \
-	aarch64-gen.c \
-	i386-gen.c \
-	ia64-asmtab.c \
-	ia64-gen.c \
-	ia64-opc-a.c \
-	ia64-opc-b.c \
-	ia64-opc-f.c \
-	ia64-opc-i.c \
-	ia64-opc-m.c \
-	ia64-opc-d.c \
-	s390-mkopc.c \
-	z8kgen.c
-
 ALL32_MACHINES = $(TARGET32_LIBOPCODES_CFILES:.c=.lo)
 ALL64_MACHINES = $(TARGET64_LIBOPCODES_CFILES:.c=.lo)
 
@@ -341,7 +325,7 @@ stamp-lib: libopcodes.la
 
 libopcodes.a: stamp-lib ; @true
 
-POTFILES = $(HFILES) $(CFILES)
+POTFILES = $(HFILES) $(LIBOPCODES_CFILES)
 po/POTFILES.in: @MAINT@ Makefile
 	for f in $(POTFILES); do echo $$f; done | LC_ALL=C sort > tmp \
 	  && mv tmp $(srcdir)/po/POTFILES.in
--- a/opcodes/Makefile.in
+++ b/opcodes/Makefile.in
@@ -670,23 +670,6 @@ LIBOPCODES_CFILES = \
 	dis-init.c \
 	disassemble.c
 
-
-# C source files that correspond to .o's.
-CFILES = \
-	$(LIBOPCODES_CFILES) \
-	aarch64-gen.c \
-	i386-gen.c \
-	ia64-asmtab.c \
-	ia64-gen.c \
-	ia64-opc-a.c \
-	ia64-opc-b.c \
-	ia64-opc-f.c \
-	ia64-opc-i.c \
-	ia64-opc-m.c \
-	ia64-opc-d.c \
-	s390-mkopc.c \
-	z8kgen.c
-
 ALL32_MACHINES = $(TARGET32_LIBOPCODES_CFILES:.c=.lo)
 ALL64_MACHINES = $(TARGET64_LIBOPCODES_CFILES:.c=.lo)
 OFILES = @BFD_MACHINES@
@@ -706,7 +689,7 @@ EXTRA_libopcodes_la_SOURCES = $(LIBOPCOD
 # should be removed if everything else starts using libtool.  FIXME.
 noinst_LIBRARIES = libopcodes.a
 libopcodes_a_SOURCES = 
-POTFILES = $(HFILES) $(CFILES)
+POTFILES = $(HFILES) $(LIBOPCODES_CFILES)
 CLEANFILES = \
 	stamp-epiphany stamp-fr30 stamp-frv stamp-ip2k stamp-iq2000 stamp-lm32 \
 	stamp-m32c stamp-m32r stamp-mep stamp-mt stamp-or1k stamp-xstormy16 \
--- a/opcodes/po/POTFILES.in
+++ b/opcodes/po/POTFILES.in
@@ -4,7 +4,6 @@ aarch64-asm.h
 aarch64-dis-2.c
 aarch64-dis.c
 aarch64-dis.h
-aarch64-gen.c
 aarch64-opc-2.c
 aarch64-opc.c
 aarch64-opc.h
@@ -72,18 +71,9 @@ ft32-opc.c
 h8300-dis.c
 hppa-dis.c
 i386-dis.c
-i386-gen.c
 i386-opc.h
-ia64-asmtab.c
 ia64-asmtab.h
 ia64-dis.c
-ia64-gen.c
-ia64-opc-a.c
-ia64-opc-b.c
-ia64-opc-d.c
-ia64-opc-f.c
-ia64-opc-i.c
-ia64-opc-m.c
 ia64-opc.c
 ia64-opc.h
 ip2k-asm.c
@@ -191,7 +181,6 @@ rx-dis.c
 s12z-dis.c
 s12z-opc.c
 s390-dis.c
-s390-mkopc.c
 s390-opc.c
 score-dis.c
 score-opc.h
@@ -231,4 +220,3 @@ xtensa-dis.c
 z80-dis.c
 z8k-dis.c
 z8k-opc.h
-z8kgen.c


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-20  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-20  9:29 [PATCH 0/2] opcodes: no internationalization needed for build helper tools Jan Beulich
2023-01-20  9:30 ` [PATCH 1/2] x86: remove internationalization from i386-gen.c Jan Beulich
2023-01-20  9:31 ` [PATCH 2/2] opcodes: suppress internationalization on build helper tools Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).