This is the mail archive of the binutils@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]

warning fixes


Fedora 7 spits out a bunch of "warning: ignoring return value of blah,
declared with attribute warn_unused_result" when building binutils.
This patch quiets some of these warnings, and an error due to the
newer glibc headers defining an "fprintf" macro.  Libiberty has some
similar warnings, and I didn't bother fixing
"opcodes/mt-opc.c:918: warning: memset used with constant zero length
parameter; this could be due to transposed parameters"
because it's in generated code and the constant and length param of
this particular memset are both zero.  ie. it isn't a transposition
error so the glibc warning is a bit daft.

The patch isn't perfect.  I left some FIXMEs for someone who cares
more than I do about bfd/vms-misc.c and binutils/srconv.c.

bfd/
	* coff-arm.c (arm_emit_base_file_entry): Check fwrite return value.
	Return status.  Adjust callers.
	* coff-mcore.c (mcore_emit_base_file_entry): Likewise.
	* coff-ppc.c (write_base_file_entry): New function.
	(coff_ppc_relocate_section): Use it.
	* elf32-arm.c (find_thumb_glue): Check asprintf return status.
	(find_arm_glue): Likewise.
	* vms-misc.c (_bfd_vms_output_flush): Check fwrite return value.
bfd/doc/
	* chew.c (write_buffer): Check fwrite return value.
binutils/
	* objdump.c (print_line): Check fwrite return value.
	* srconv.c (checksum, wr_tr, wr_cs): Likewise.
	* sysdump.c (fillup): Return zero on getc or fread EOF.  Return count
	read.
gas/
	* read.c (do_s_func): Check asprintf return status.
	* stabs.c (stabs_generate_asm_func): Likewise.
	(stabs_generate_asm_endfunc): Likewise.
opcodes/
	* mcore-dis.c (print_insn_mcore): Protect "fprintf" var against
	macro expansion.

Index: bfd/coff-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-arm.c,v
retrieving revision 1.72
diff -u -p -r1.72 coff-arm.c
--- bfd/coff-arm.c	3 Jul 2007 14:26:39 -0000	1.72
+++ bfd/coff-arm.c	14 Oct 2007 00:33:18 -0000
@@ -939,21 +939,24 @@ coff_arm_link_hash_table_create (bfd * a
   return & ret->root.root;
 }
 
-static void
+static bfd_boolean
 arm_emit_base_file_entry (struct bfd_link_info *info,
 			  bfd *output_bfd,
 			  asection *input_section,
 			  bfd_vma reloc_offset)
 {
-  bfd_vma addr = reloc_offset
-                - input_section->vma
-                + input_section->output_offset
-                  + input_section->output_section->vma;
+  bfd_vma addr = (reloc_offset
+		  - input_section->vma
+		  + input_section->output_offset
+		  + input_section->output_section->vma);
 
   if (coff_data (output_bfd)->pe)
      addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
-  fwrite (& addr, 1, sizeof (addr), (FILE *) info->base_file);
+  if (fwrite (&addr, sizeof (addr), 1, (FILE *) info->base_file) == 1)
+    return TRUE;
 
+  bfd_set_error (bfd_error_system_call);
+  return FALSE;
 }
 
 #ifndef ARM_WINCE
@@ -1381,10 +1384,10 @@ coff_arm_relocate_section (bfd *output_b
 			  bfd_put_32 (output_bfd, h_val | a2t3_func_addr_insn,
 				      s->contents + my_offset + 8);
 
-                          if (info->base_file)
-                            arm_emit_base_file_entry (info, output_bfd, s,
-                                                      my_offset + 8);
-
+                          if (info->base_file
+			      && !arm_emit_base_file_entry (info, output_bfd,
+							    s, my_offset + 8))
+			    return FALSE;
 			}
 
 		      BFD_ASSERT (my_offset <= globals->arm_glue_size);
@@ -1486,9 +1489,11 @@ coff_arm_relocate_section (bfd *output_b
 			      bfd_put_32 (output_bfd, h_val,
 					  s->contents + my_offset + 16);
 
-                              if (info->base_file)
-                                arm_emit_base_file_entry (info, output_bfd, s,
-							  my_offset + 16);
+                              if (info->base_file
+				  && !arm_emit_base_file_entry (info,
+								output_bfd, s,
+								my_offset + 16))
+				return FALSE;
 			    }
 			  else
 			    {
@@ -1572,13 +1577,13 @@ coff_arm_relocate_section (bfd *output_b
 	    }
 	}
 
-      if (info->base_file)
-	{
-	  /* Emit a reloc if the backend thinks it needs it.  */
-	  if (sym && pe_data(output_bfd)->in_reloc_p(output_bfd, howto))
-            arm_emit_base_file_entry (info, output_bfd, input_section,
-				      rel->r_vaddr);
-	}
+      /* Emit a reloc if the backend thinks it needs it.  */
+      if (info->base_file
+	  && sym
+	  && pe_data(output_bfd)->in_reloc_p(output_bfd, howto)
+	  && !arm_emit_base_file_entry (info, output_bfd, input_section,
+					rel->r_vaddr))
+	return FALSE;
 
       if (done)
 	rstat = bfd_reloc_ok;
Index: bfd/coff-mcore.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-mcore.c,v
retrieving revision 1.38
diff -u -p -r1.38 coff-mcore.c
--- bfd/coff-mcore.c	3 Jul 2007 14:26:39 -0000	1.38
+++ bfd/coff-mcore.c	14 Oct 2007 00:33:18 -0000
@@ -51,8 +51,6 @@ static reloc_howto_type *coff_mcore_rtyp
   PARAMS ((bfd *, asection *, struct internal_reloc *,
 	   struct coff_link_hash_entry *, struct internal_syment *,
 	   bfd_vma *));
-static void mcore_emit_base_file_entry
-  PARAMS ((struct bfd_link_info *, bfd *, asection *, bfd_vma));
 static bfd_boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
 
 /* The NT loader points the toc register to &toc + 32768, in order to
@@ -221,12 +219,11 @@ mcore_hash_table;
 
 /* Add an entry to the base file.  */
 
-static void
-mcore_emit_base_file_entry (info, output_bfd, input_section, reloc_offset)
-      struct bfd_link_info * info;
-      bfd *                  output_bfd;
-      asection *             input_section;
-      bfd_vma                reloc_offset;
+static bfd_boolean
+mcore_emit_base_file_entry (struct bfd_link_info *info,
+			    bfd *output_bfd,
+			    asection *input_section,
+			    bfd_vma reloc_offset)
 {
   bfd_vma addr = reloc_offset
                  - input_section->vma
@@ -236,7 +233,11 @@ mcore_emit_base_file_entry (info, output
   if (coff_data (output_bfd)->pe)
      addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
 
-  fwrite (&addr, 1, sizeof (addr), (FILE *) info->base_file);
+  if (fwrite (&addr, sizeof (addr), 1, (FILE *) info->base_file) == 1)
+    return TRUE;
+
+  bfd_set_error (bfd_error_system_call);
+  return FALSE;
 }
 
 static bfd_reloc_status_type
@@ -522,12 +523,13 @@ coff_mcore_relocate_section (output_bfd,
 	  break;
 	}
 
-      if (info->base_file)
-	{
-	  /* Emit a reloc if the backend thinks it needs it.  */
-	  if (sym && pe_data (output_bfd)->in_reloc_p (output_bfd, howto))
-            mcore_emit_base_file_entry (info, output_bfd, input_section, rel->r_vaddr);
-	}
+      /* Emit a reloc if the backend thinks it needs it.  */
+      if (info->base_file
+	  && sym
+	  && pe_data (output_bfd)->in_reloc_p (output_bfd, howto)
+	  && !mcore_emit_base_file_entry (info, output_bfd, input_section,
+					  rel->r_vaddr))
+	return FALSE;
 
       switch (rstat)
 	{
Index: bfd/coff-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-ppc.c,v
retrieving revision 1.33
diff -u -p -r1.33 coff-ppc.c
--- bfd/coff-ppc.c	3 Jul 2007 14:26:39 -0000	1.33
+++ bfd/coff-ppc.c	14 Oct 2007 00:33:19 -0000
@@ -982,6 +982,18 @@ static bfd_boolean in_reloc_p(abfd, howt
       && (howto->type != IMAGE_REL_PPC_TOCREL16_DEFN) ;
 }
 
+static bfd_boolean
+write_base_file_entry (bfd *obfd, struct bfd_link_info *info, bfd_vma addr)
+{
+  if (coff_data (obfd)->pe)
+     addr -= pe_data (obfd)->pe_opthdr.ImageBase;
+  if (fwrite (&addr, sizeof (addr), 1, (FILE *) info->base_file) == 1)
+    return TRUE;
+
+  bfd_set_error (bfd_error_system_call);
+  return FALSE;
+}
+
 /* The reloc processing routine for the optimized COFF linker.  */
 
 static bfd_boolean
@@ -1237,10 +1249,8 @@ coff_ppc_relocate_section (output_bfd, i
 		bfd_vma addr = (toc_section->output_section->vma
 				+ toc_section->output_offset + our_toc_offset);
 
-		if (coff_data (output_bfd)->pe)
-		  addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
-
-		fwrite (&addr, 1,4, (FILE *) info->base_file);
+		if (!write_base_file_entry (output_bfd, info, addr))
+		  return FALSE;
 	      }
 
 	    /* FIXME: this test is conservative.  */
@@ -1453,15 +1463,13 @@ coff_ppc_relocate_section (output_bfd, i
 	      /* Relocation to a symbol in a section which
 		 isn't absolute - we output the address here
 		 to a file.  */
-	      bfd_vma addr = rel->r_vaddr
-		- input_section->vma
-		+ input_section->output_offset
-		  + input_section->output_section->vma;
+	      bfd_vma addr = (rel->r_vaddr
+			      - input_section->vma
+			      + input_section->output_offset
+			      + input_section->output_section->vma);
 
-	      if (coff_data (output_bfd)->pe)
-		addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
-
-	      fwrite (&addr, 1,4, (FILE *) info->base_file);
+	      if (!write_base_file_entry (output_bfd, info, addr))
+		return FALSE;
 	    }
 	}
 
Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.128
diff -u -p -r1.128 elf32-arm.c
--- bfd/elf32-arm.c	28 Sep 2007 08:43:45 -0000	1.128
+++ bfd/elf32-arm.c	14 Oct 2007 00:33:26 -0000
@@ -2520,9 +2520,10 @@ find_thumb_glue (struct bfd_link_info *l
   hash = elf_link_hash_lookup
     (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE);
 
-  if (hash == NULL)
-    asprintf (error_message, _("unable to find THUMB glue '%s' for '%s'"),
-	      tmp_name, name);
+  if (hash == NULL
+      && asprintf (error_message, _("unable to find THUMB glue '%s' for '%s'"),
+		   tmp_name, name) == -1)
+    *error_message = (char *) bfd_errmsg (bfd_error_system_call);
 
   free (tmp_name);
 
@@ -2553,9 +2554,10 @@ find_arm_glue (struct bfd_link_info *lin
   myh = elf_link_hash_lookup
     (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE);
 
-  if (myh == NULL)
-    asprintf (error_message, _("unable to find ARM glue '%s' for '%s'"),
-	      tmp_name, name);
+  if (myh == NULL
+      && asprintf (error_message, _("unable to find ARM glue '%s' for '%s'"),
+		   tmp_name, name) == -1)
+    *error_message = (char *) bfd_errmsg (bfd_error_system_call);
 
   free (tmp_name);
 
Index: bfd/vms-misc.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-misc.c,v
retrieving revision 1.26
diff -u -p -r1.26 vms-misc.c
--- bfd/vms-misc.c	3 Jul 2007 14:26:43 -0000	1.26
+++ bfd/vms-misc.c	14 Oct 2007 00:33:26 -0000
@@ -691,12 +691,17 @@ _bfd_vms_output_flush (bfd * abfd)
 
   if (PRIV (push_level) == 0)
     {
+      if (0
 #ifndef VMS
-	/* Write length first, see FF_FOREIGN in the input routines.  */
-      fwrite (PRIV (output_buf) + 2, 2, 1, (FILE *) abfd->iostream);
-#endif
-      fwrite (PRIV (output_buf), (size_t) real_size, 1,
-	      (FILE *) abfd->iostream);
+	  /* Write length first, see FF_FOREIGN in the input routines.  */
+	  || fwrite (PRIV (output_buf) + 2, 2, 1,
+		     (FILE *) abfd->iostream) != 1
+#endif
+	  || (real_size != 0
+	      && fwrite (PRIV (output_buf), (size_t) real_size, 1,
+			 (FILE *) abfd->iostream) != 1))
+	/* FIXME: Return error status.  */
+	abort ();
 
       PRIV (output_size) = 0;
     }
Index: bfd/doc/chew.c
===================================================================
RCS file: /cvs/src/src/bfd/doc/chew.c,v
retrieving revision 1.20
diff -u -p -r1.20 chew.c
--- bfd/doc/chew.c	3 Jul 2007 14:26:43 -0000	1.20
+++ bfd/doc/chew.c	14 Oct 2007 00:33:27 -0000
@@ -120,6 +120,7 @@ static void overwrite_string (string_typ
 static void catbuf (string_type *, char *, unsigned int);
 static void cattext (string_type *, char *);
 static void catstr (string_type *, string_type *);
+static void die (char *);
 #endif
 
 static void
@@ -162,7 +163,9 @@ write_buffer (buffer, f)
      string_type *buffer;
      FILE *f;
 {
-  fwrite (buffer->ptr, buffer->write_idx, 1, f);
+  if (buffer->write_idx != 0
+      && fwrite (buffer->ptr, buffer->write_idx, 1, f) != 1)
+    die ("cannot write output");
 }
 
 static void
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.132
diff -u -p -r1.132 objdump.c
--- binutils/objdump.c	10 Jul 2007 13:52:39 -0000	1.132
+++ binutils/objdump.c	14 Oct 2007 00:33:31 -0000
@@ -1130,14 +1130,17 @@ static void 
 print_line (struct print_file_list *p, unsigned int line)
 {
   const char *l;
+  size_t len;
  
   --line; 
   if (line >= p->maxline)
     return;
   l = p->linemap [line];
-  fwrite (l, 1, strcspn (l, "\n\r"), stdout);
-  putchar ('\n');
-} 
+  /* Test fwrite return value to quiet glibc warning.  */
+  len = strcspn (l, "\n\r");
+  if (len == 0 || fwrite (l, len, 1, stdout) == 1)
+    putchar ('\n');
+}
 
 /* Print a range of source code lines. */
 
Index: binutils/srconv.c
===================================================================
RCS file: /cvs/src/src/binutils/srconv.c,v
retrieving revision 1.23
diff -u -p -r1.23 srconv.c
--- binutils/srconv.c	19 Jul 2007 16:17:38 -0000	1.23
+++ binutils/srconv.c	14 Oct 2007 00:33:32 -0000
@@ -176,7 +176,9 @@ checksum (FILE *file, unsigned char *ptr
 
   /* Glue on a checksum too.  */
   ptr[bytes] = ~sum;
-  fwrite (ptr, bytes + 1, 1, file);
+  if (fwrite (ptr, bytes + 1, 1, file) != 1)
+    /* FIXME: Return error status.  */
+    abort ();
 }
 
 
@@ -299,7 +301,10 @@ wr_tr (void)
       0x03,			/* RL */
       0xfd,			/* CS */
     };
-  fwrite (b, 1, sizeof (b), file);
+
+  if (fwrite (b, sizeof (b), 1, file) != 1)
+    /* FIXME: Return error status.  */
+    abort ();
 }
 
 static void
@@ -1452,7 +1457,10 @@ wr_cs (void)
     0x00,			/* dot */
     0xDE			/* CS */
   };
-  fwrite (b, 1, sizeof (b), file);
+
+  if (fwrite (b, sizeof (b), 1, file) != 1)
+    /* FIXME: Return error status.  */
+    abort ();
 }
 
 /* Write out the SC records for a unit.  Create an SC
Index: binutils/sysdump.c
===================================================================
RCS file: /cvs/src/src/binutils/sysdump.c,v
retrieving revision 1.19
diff -u -p -r1.19 sysdump.c
--- binutils/sysdump.c	5 Jul 2007 16:54:45 -0000	1.19
+++ binutils/sysdump.c	14 Oct 2007 00:33:32 -0000
@@ -119,8 +119,15 @@ fillup (unsigned char *ptr)
   int sum;
   int i;
 
-  size = getc (file) - 2;
-  fread (ptr, 1, size, file);
+  size = getc (file);
+  if (size == EOF
+      || size <= 2)
+    return 0;
+
+  size -= 2;
+  if (fread (ptr, size, 1, file) != 1)
+    return 0;
+
   sum = code + size + 2;
 
   for (i = 0; i < size; i++)
@@ -132,7 +139,7 @@ fillup (unsigned char *ptr)
   if (dump)
     dh (ptr, size);
 
-  return size - 1;
+  return size;
 }
 
 static barray
Index: gas/read.c
===================================================================
RCS file: /cvs/src/src/gas/read.c,v
retrieving revision 1.131
diff -u -p -r1.131 read.c
--- gas/read.c	4 Oct 2007 17:05:36 -0000	1.131
+++ gas/read.c	14 Oct 2007 00:33:38 -0000
@@ -5671,14 +5671,20 @@ do_s_func (int end_p, const char *defaul
       if (*input_line_pointer != ',')
 	{
 	  if (default_prefix)
-	    asprintf (&label, "%s%s", default_prefix, name);
+	    {
+	      if (asprintf (&label, "%s%s", default_prefix, name) == -1)
+		as_fatal ("%s", xstrerror (errno));
+	    }
 	  else
 	    {
 	      char leading_char = bfd_get_symbol_leading_char (stdoutput);
 	      /* Missing entry point, use function's name with the leading
 		 char prepended.  */
 	      if (leading_char)
-		asprintf (&label, "%c%s", leading_char, name);
+		{
+		  if (asprintf (&label, "%c%s", leading_char, name) == -1)
+		    as_fatal ("%s", xstrerror (errno));
+		}
 	      else
 		label = name;
 	    }
Index: gas/stabs.c
===================================================================
RCS file: /cvs/src/src/gas/stabs.c,v
retrieving revision 1.30
diff -u -p -r1.30 stabs.c
--- gas/stabs.c	3 Oct 2007 11:35:16 -0000	1.30
+++ gas/stabs.c	14 Oct 2007 00:33:38 -0000
@@ -669,8 +669,9 @@ stabs_generate_asm_func (const char *fun
     }
 
   as_where (&file, &lineno);
-  asprintf (&buf, "\"%s:F1\",%d,0,%d,%s",
-	    funcname, N_FUN, lineno + 1, startlabname);
+  if (asprintf (&buf, "\"%s:F1\",%d,0,%d,%s",
+		funcname, N_FUN, lineno + 1, startlabname) == -1)
+    as_fatal ("%s", xstrerror (errno));
   input_line_pointer = buf;
   s_stab ('s');
   free (buf);
@@ -695,7 +696,8 @@ stabs_generate_asm_endfunc (const char *
   ++label_count;
   colon (sym);
 
-  asprintf (&buf, "\"\",%d,0,0,%s-%s", N_FUN, sym, startlabname);
+  if (asprintf (&buf, "\"\",%d,0,0,%s-%s", N_FUN, sym, startlabname) == -1)
+    as_fatal ("%s", xstrerror (errno));
   input_line_pointer = buf;
   s_stab ('s');
   free (buf);
Index: opcodes/mcore-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/mcore-dis.c,v
retrieving revision 1.21
diff -u -p -r1.21 mcore-dis.c
--- opcodes/mcore-dis.c	5 Jul 2007 09:49:02 -0000	1.21
+++ opcodes/mcore-dis.c	14 Oct 2007 00:34:17 -0000
@@ -122,12 +122,12 @@ print_insn_mcore (memaddr, info)
       break;
 
   if (op->name == 0)
-    fprintf (stream, ".short 0x%04x", inst);
+    (*fprintf) (stream, ".short 0x%04x", inst);
   else
     {
       const char *name = grname[inst & 0x0F];
 
-      fprintf (stream, "%s", op->name);
+      (*fprintf) (stream, "%s", op->name);
 
       switch (op->opclass)
 	{
@@ -135,42 +135,42 @@ print_insn_mcore (memaddr, info)
 	  break;
 
 	case OT:
-	  fprintf (stream, "\t%d", inst & 0x3);
+	  (*fprintf) (stream, "\t%d", inst & 0x3);
 	  break;
 
 	case O1:
 	case JMP:
 	case JSR:
-	  fprintf (stream, "\t%s", name);
+	  (*fprintf) (stream, "\t%s", name);
 	  break;
 
 	case OC:
-	  fprintf (stream, "\t%s, %s", name, crname[(inst >> 4) & 0x1F]);
+	  (*fprintf) (stream, "\t%s, %s", name, crname[(inst >> 4) & 0x1F]);
 	  break;
 
 	case O1R1:
-	  fprintf (stream, "\t%s, r1", name);
+	  (*fprintf) (stream, "\t%s, r1", name);
 	  break;
 
 	case MULSH:
 	case O2:
-	  fprintf (stream, "\t%s, %s", name, grname[(inst >> 4) & 0xF]);
+	  (*fprintf) (stream, "\t%s, %s", name, grname[(inst >> 4) & 0xF]);
 	  break;
 
 	case X1:
-	  fprintf (stream, "\tr1, %s", name);
+	  (*fprintf) (stream, "\tr1, %s", name);
 	  break;
 
 	case OI:
-	  fprintf (stream, "\t%s, %d", name, ((inst >> 4) & 0x1F) + 1);
+	  (*fprintf) (stream, "\t%s, %d", name, ((inst >> 4) & 0x1F) + 1);
 	  break;
 
 	case RM:
-	  fprintf (stream, "\t%s-r15, (r0)", name);
+	  (*fprintf) (stream, "\t%s-r15, (r0)", name);
 	  break;
 
 	case RQ:
-	  fprintf (stream, "\tr4-r7, (%s)", name);
+	  (*fprintf) (stream, "\tr4-r7, (%s)", name);
 	  break;
 
 	case OB:
@@ -182,16 +182,16 @@ print_insn_mcore (memaddr, info)
 	case OMa:
 	case OMb:
 	case OMc:
-	  fprintf (stream, "\t%s, %d", name, (inst >> 4) & 0x1F);
+	  (*fprintf) (stream, "\t%s, %d", name, (inst >> 4) & 0x1F);
 	  break;
 
 	case I7:
-	  fprintf (stream, "\t%s, %d", name, (inst >> 4) & 0x7F);
+	  (*fprintf) (stream, "\t%s, %d", name, (inst >> 4) & 0x7F);
 	  break;
 
 	case LS:
-	  fprintf (stream, "\t%s, (%s, %d)", grname[(inst >> 8) & 0xF],
-		   name, ((inst >> 4) & 0xF) << isiz[(inst >> 13) & 3]);
+	  (*fprintf) (stream, "\t%s, (%s, %d)", grname[(inst >> 8) & 0xF],
+		      name, ((inst >> 4) & 0xF) << isiz[(inst >> 13) & 3]);
 	  break;
 
 	case BR:
@@ -201,7 +201,7 @@ print_insn_mcore (memaddr, info)
 	    if (inst & 0x400)
 	      val |= 0xFFFFFC00;
 
-	    fprintf (stream, "\t0x%lx", (long)(memaddr + 2 + (val << 1)));
+	    (*fprintf) (stream, "\t0x%lx", (long)(memaddr + 2 + (val << 1)));
 
 	    if (strcmp (op->name, "bsr") == 0)
 	      {
@@ -210,7 +210,7 @@ print_insn_mcore (memaddr, info)
 
 		if (info->print_address_func && val != 0)
 		  {
-		    fprintf (stream, "\t// ");
+		    (*fprintf) (stream, "\t// ");
 		    info->print_address_func (val, info);
 		  }
 	      }
@@ -221,8 +221,9 @@ print_insn_mcore (memaddr, info)
 	  {
 	    long val;
 	    val = (inst & 0x000F);
-	    fprintf (stream, "\t%s, 0x%lx",
-		     grname[(inst >> 4) & 0xF], (long)(memaddr - (val << 1)));
+	    (*fprintf) (stream, "\t%s, 0x%lx",
+			grname[(inst >> 4) & 0xF],
+			(long) (memaddr - (val << 1)));
 	  }
 	  break;
 
@@ -247,11 +248,12 @@ print_insn_mcore (memaddr, info)
 		| (ibytes[2] << 8) | (ibytes[3]);
 
 	    /* Removed [] around literal value to match ABI syntax 12/95.  */
-	    fprintf (stream, "\t%s, 0x%lX", grname[(inst >> 8) & 0xF], val);
+	    (*fprintf) (stream, "\t%s, 0x%lX", grname[(inst >> 8) & 0xF], val);
 
 	    if (val == 0)
-	      fprintf (stream, "\t// from address pool at 0x%lx",
-		       (long)(memaddr + 2 + ((inst & 0xFF) << 2)) & 0xFFFFFFFC);
+	      (*fprintf) (stream, "\t// from address pool at 0x%lx",
+			  (long) (memaddr + 2
+				  + ((inst & 0xFF) << 2)) & 0xFFFFFFFC);
 	  }
 	  break;
 
@@ -276,17 +278,18 @@ print_insn_mcore (memaddr, info)
 		| (ibytes[2] << 8) | (ibytes[3]);
 
 	    /* Removed [] around literal value to match ABI syntax 12/95.  */
-	    fprintf (stream, "\t0x%lX", val);
+	    (*fprintf) (stream, "\t0x%lX", val);
 	    /* For jmpi/jsri, we'll try to get a symbol for the target.  */
 	    if (info->print_address_func && val != 0)
 	      {
-		fprintf (stream, "\t// ");
+		(*fprintf) (stream, "\t// ");
 		info->print_address_func (val, info);
 	      }
 	    else
 	      {
-		fprintf (stream, "\t// from address pool at 0x%lx",
-			 (long)(memaddr + 2 + ((inst & 0xFF) << 2)) & 0xFFFFFFFC);
+		(*fprintf) (stream, "\t// from address pool at 0x%lx",
+			    (long) (memaddr + 2
+				    + ((inst & 0xFF) << 2)) & 0xFFFFFFFC);
 	      }
 	  }
 	  break;
@@ -298,13 +301,13 @@ print_insn_mcore (memaddr, info)
 	      "ee", "ee,ie", "ee,fe", "ee,fe,ie"
 	    };
 
-	    fprintf (stream, "\t%s", fields[inst & 0x7]);
+	    (*fprintf) (stream, "\t%s", fields[inst & 0x7]);
 	  }
 	  break;
 
 	default:
 	  /* If the disassembler lags the instruction set.  */
-	  fprintf (stream, "\tundecoded operands, inst is 0x%04x", inst);
+	  (*fprintf) (stream, "\tundecoded operands, inst is 0x%04x", inst);
 	  break;
 	}
     }

-- 
Alan Modra
Australia Development Lab, IBM


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