z8k opcode_entry_type

Alan Modra amodra@gmail.com
Wed Jul 9 00:00:25 GMT 2025


z8k opcode_entry_type.func is never used as a function pointer, only
as a pointer to a pseudo_typeS.  Change it to a void*.

diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c
index 9947fe1e1fc..2980cffd59a 100644
--- a/gas/config/tc-z8k.c
+++ b/gas/config/tc-z8k.c
@@ -164,7 +164,7 @@ md_begin (void)
       opcode_entry_type *fake_opcode;
       fake_opcode = XNEW (opcode_entry_type);
       fake_opcode->name = md_pseudo_table[idx].poc_name;
-      fake_opcode->func = (void *) (md_pseudo_table + idx);
+      fake_opcode->p = md_pseudo_table + idx;
       fake_opcode->opcode = 250;
       str_hash_insert (opcode_hash_control, fake_opcode->name, fake_opcode, 0);
     }
@@ -1248,7 +1248,7 @@ md_assemble (char *str)
 
   if (opcode->opcode == 250)
     {
-      pseudo_typeS *p;
+      const pseudo_typeS *p;
       char oc;
       char *old = input_line_pointer;
 
@@ -1260,7 +1260,7 @@ md_assemble (char *str)
       *old = '\n';
       while (is_whitespace (*input_line_pointer))
 	input_line_pointer++;
-      p = (pseudo_typeS *) (opcode->func);
+      p = opcode->p;
 
       (p->poc_handler) (p->poc_val);
       input_line_pointer = old;
diff --git a/opcodes/z8k-opc.h b/opcodes/z8k-opc.h
index e8c9c886717..933615eb0ea 100644
--- a/opcodes/z8k-opc.h
+++ b/opcodes/z8k-opc.h
@@ -289,7 +289,7 @@ typedef struct {
 #endif
   const char *name;
   unsigned char opcode;
-  void (*func) (void);
+  const void *p;
   unsigned int arg_info[4];
   unsigned int byte_info[10];
   unsigned int noperands;
diff --git a/opcodes/z8kgen.c b/opcodes/z8kgen.c
index 9dc5bddf00f..1b2da6b6d05 100644
--- a/opcodes/z8kgen.c
+++ b/opcodes/z8kgen.c
@@ -1287,7 +1287,7 @@ gas (void)
   printf ("#endif\n");
   printf ("  const char *name;\n");
   printf ("  unsigned char opcode;\n");
-  printf ("  void (*func) (void);\n");
+  printf ("  const void *p;\n");
   printf ("  unsigned int arg_info[4];\n");
   printf ("  unsigned int byte_info[%d];\n", BYTE_INFO_LEN);
   printf ("  unsigned int noperands;\n");

-- 
Alan Modra


More information about the Binutils mailing list