XCOFF64 fixes. For setting arch/mach and for R_BR relocations.
[deliverable/binutils-gdb.git] / bfd / libbfd.c
index f7320cc4e2f470adda9bcd151aa81d9d4ad698b3..a397d8215d792c756fc7f8ad3499dce27472db17 100644 (file)
@@ -1,24 +1,24 @@
 /* Assorted BFD support routines, only used internally.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001
+   2000, 2001, 2002
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -581,8 +581,7 @@ bfd_bwrite (ptr, size, abfd)
   if (nwrote != size)
     {
 #ifdef ENOSPC
-      if (nwrote >= 0)
-       errno = ENOSPC;
+      errno = ENOSPC;
 #endif
       bfd_set_error (bfd_error_system_call);
     }
@@ -594,7 +593,7 @@ INTERNAL_FUNCTION
        bfd_write_bigendian_4byte_int
 
 SYNOPSIS
-       void bfd_write_bigendian_4byte_int (bfd *, unsigned int);
+       boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
 
 DESCRIPTION
        Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big
@@ -602,15 +601,14 @@ DESCRIPTION
        archives.
 
 */
-void
+boolean
 bfd_write_bigendian_4byte_int (abfd, i)
      bfd *abfd;
      unsigned int i;
 {
   bfd_byte buffer[4];
   bfd_putb32 ((bfd_vma) i, buffer);
-  if (bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) != 4)
-    abort ();
+  return bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) == 4;
 }
 
 bfd_vma
@@ -869,14 +867,14 @@ DESCRIPTION
 .               BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
 .
 .#define bfd_get(bits, abfd, ptr)                              \
-.                ((bits) == 8 ? bfd_get_8 (abfd, ptr)          \
+.                ( (bits) ==  8 ? (bfd_vma) bfd_get_8 (abfd, ptr)      \
 .               : (bits) == 16 ? bfd_get_16 (abfd, ptr)        \
 .               : (bits) == 32 ? bfd_get_32 (abfd, ptr)        \
 .               : (bits) == 64 ? bfd_get_64 (abfd, ptr)        \
 .               : (abort (), (bfd_vma) - 1))
 .
 .#define bfd_put(bits, abfd, val, ptr)                         \
-.                ((bits) == 8 ? bfd_put_8 (abfd, val, ptr)     \
+.                ( (bits) ==  8 ? bfd_put_8  (abfd, val, ptr)  \
 .               : (bits) == 16 ? bfd_put_16 (abfd, val, ptr)   \
 .               : (bits) == 32 ? bfd_put_32 (abfd, val, ptr)   \
 .               : (bits) == 64 ? bfd_put_64 (abfd, val, ptr)   \
@@ -1449,6 +1447,7 @@ _bfd_generic_verify_endian_match (ibfd, obfd)
 
 /* Give a warning at runtime if someone compiles code which calls
    old routines.  */
+
 void
 warn_deprecated (what, file, line, func)
      const char *what;
@@ -1461,11 +1460,13 @@ warn_deprecated (what, file, line, func)
 
   if (~(size_t) func & ~mask)
     {
-      fprintf (stderr, _("Deprecated %s called"), what);
+      /* Note: seperate sentances in order to allow
+        for translation into other languages.  */
       if (func)
-       fprintf (stderr, _(" at %s line %d in %s\n"), file, line, func);
+       fprintf (stderr, _("Deprecated %s called at %s line %d in %s\n"),
+                what, file, line, func);
       else
-       fprintf (stderr, "\n");
+       fprintf (stderr, _("Deprecated %s called\n"), what);
       mask |= ~(size_t) func;
     }
 }
This page took 0.026273 seconds and 4 git commands to generate.