opcodes tidy: PR 33384 invalid disassembler option message

Message ID aMpTuNst5Ub3fktZ@squeak.grove.modra.org
State New
Headers
Series opcodes tidy: PR 33384 invalid disassembler option message |

Commit Message

Alan Modra Sept. 17, 2025, 6:22 a.m. UTC
  Once both the gdb and opcodes fix for this PR are committed, these are
unused.

include/
	* dis-asm.h (disassembler_options_cmp, next_disassembler_option),
	(FOR_EACH_DISASSEMBLER_OPTION): Delete.
opcodes/
	* disassemble.c (disassembler_options_cmp): Delete.
  

Patch

diff --git a/include/dis-asm.h b/include/dis-asm.h
index c10c4c85a38..4836734edbe 100644
--- a/include/dis-asm.h
+++ b/include/dis-asm.h
@@ -434,27 +434,6 @@  extern void disassembler_usage (FILE *);
 
 /* Remove whitespace and consecutive commas.  */
 extern char *remove_whitespace_and_extra_commas (char *);
-
-/* Like STRCMP, but treat ',' the same as '\0' so that we match
-   strings like "foobar" against "foobar,xxyyzz,...".  */
-extern int disassembler_options_cmp (const char *, const char *);
-
-/* A helper function for FOR_EACH_DISASSEMBLER_OPTION.  */
-static inline const char *
-next_disassembler_option (const char *options)
-{
-  const char *opt = strchr (options, ',');
-  if (opt != NULL)
-    opt++;
-  return opt;
-}
-
-/* A macro for iterating over each comma separated option in OPTIONS.  */
-#define FOR_EACH_DISASSEMBLER_OPTION(OPT, OPTIONS) \
-  for ((OPT) = (OPTIONS); \
-       (OPT) != NULL; \
-       (OPT) = next_disassembler_option (OPT))
-
 
 /* This block of definitions is for particular callers who read instructions
    into a buffer before calling the instruction decoder.  */
diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c
index 53ee1ecf38b..eb4d44dca61 100644
--- a/opcodes/disassemble.c
+++ b/opcodes/disassemble.c
@@ -824,30 +824,6 @@  remove_whitespace_and_extra_commas (char *options)
   return (strlen (options) != 0) ? options : NULL;
 }
 
-/* Like STRCMP, but treat ',' the same as '\0' so that we match
-   strings like "foobar" against "foobar,xxyyzz,...".  */
-
-int
-disassembler_options_cmp (const char *s1, const char *s2)
-{
-  unsigned char c1, c2;
-
-  do
-    {
-      c1 = (unsigned char) *s1++;
-      if (c1 == ',')
-	c1 = '\0';
-      c2 = (unsigned char) *s2++;
-      if (c2 == ',')
-	c2 = '\0';
-      if (c1 == '\0')
-	return c1 - c2;
-    }
-  while (c1 == c2);
-
-  return c1 - c2;
-}
-
 void
 opcodes_assert (const char *file, int line)
 {