[RFA] Fix all compiler warnings on AIX
Joel Brobecker
brobecker@adacore.com
Fri Oct 28 01:07:00 GMT 2005
Hello,
The attached patch fixes all the compilation warnings on AIX
(which have been aborting the build since -Werror was introduced).
2005-10-27 Joel Brobecker <brobecker@adacore.com>
Mostly from Eric Botcazou <botcazou@adacore.com>
* rs6000-core.c: ANSIfy all function definitions.
Add missing function prototypes.
(ptr_to_uint): New type.
(rs6000coff_core_p): Use it as intermediate step in casts.
(rs6000coff_core_file_matches_executable_p): Likewise.
* xcoff-target.h (rs6000coff_core_p): Fix prototype.
(rs6000coff_core_file_matches_executable_p): Likewise.
Fixes the build failure. Tested on ppc-aix 5.1 by running the
various testsuites first with a version of binutils were rs6000-core
was built without -Werror, and then after having rebuilt it normally
but with the patch applied.
Adding the prototypes is the part I added to Eric's patch. I wasn't
exactly sure where to add them, so I just added them around the begining
of the same file.
OK to apply?
Thanks,
--
Joel
-------------- next part --------------
Index: rs6000-core.c
===================================================================
RCS file: /cvs/src/src/bfd/rs6000-core.c,v
retrieving revision 1.16
diff -u -p -r1.16 rs6000-core.c
--- rs6000-core.c 4 May 2005 15:53:38 -0000 1.16
+++ rs6000-core.c 28 Oct 2005 00:44:52 -0000
@@ -71,6 +71,9 @@
#include <sys/core.h>
#include <sys/systemcfg.h>
+/* Borrowed from <sys/inttypes.h> on recent AIX versions. */
+typedef unsigned long ptr_to_uint;
+
#define core_hdr(bfd) ((CoreHdr *) bfd->tdata.any)
/* AIX 4.1 changed the names and locations of a few items in the core file.
@@ -250,6 +253,15 @@ typedef union {
#define CORE_COMMONSZ ((int) &((struct core_dump *) 0)->c_entries \
+ sizeof (((struct core_dump *) 0)->c_entries))
+/* Define prototypes for certain functions, to avoid a compiler warning
+ saying that they are missing. */
+
+const bfd_target * rs6000coff_core_p (bfd *abfd);
+bfd_boolean rs6000coff_core_file_matches_executable_p (bfd *core_bfd,
+ bfd *exec_bfd);
+char * rs6000coff_core_file_failing_command (bfd *abfd);
+int rs6000coff_core_file_failing_signal (bfd *abfd);
+
/* Try to read into CORE the header from the core file associated with ABFD.
Return success. */
@@ -277,13 +289,8 @@ read_hdr (bfd *abfd, CoreHdr *core)
}
static asection *
-make_bfd_asection (abfd, name, flags, size, vma, filepos)
- bfd *abfd;
- const char *name;
- flagword flags;
- bfd_size_type size;
- bfd_vma vma;
- file_ptr filepos;
+make_bfd_asection (bfd *abfd, const char *name, flagword flags,
+ bfd_size_type size, bfd_vma vma, file_ptr filepos)
{
asection *asect;
@@ -304,8 +311,7 @@ make_bfd_asection (abfd, name, flags, si
magic number or anything like, in rs6000coff. */
const bfd_target *
-rs6000coff_core_p (abfd)
- bfd *abfd;
+rs6000coff_core_p (bfd *abfd)
{
CoreHdr core;
struct stat statbuf;
@@ -341,11 +347,11 @@ rs6000coff_core_p (abfd)
else
{
c_flag = core.old.c_flag;
- c_stack = (file_ptr) core.old.c_stack;
+ c_stack = (file_ptr) (ptr_to_uint) core.old.c_stack;
c_size = core.old.c_size;
c_stackend = COLD_STACKEND;
c_lsize = 0x7ffffff;
- c_loader = (file_ptr) COLD_LOADER (core.old);
+ c_loader = (file_ptr) (ptr_to_uint) COLD_LOADER (core.old);
proc64 = 0;
}
@@ -523,9 +529,9 @@ rs6000coff_core_p (abfd)
else
{
c_datasize = core.old.c_datasize;
- c_data = (file_ptr) core.old.c_data;
+ c_data = (file_ptr) (ptr_to_uint) core.old.c_data;
c_vmregions = core.old.c_vmregions;
- c_vmm = (file_ptr) core.old.c_vmm;
+ c_vmm = (file_ptr) (ptr_to_uint) core.old.c_vmm;
}
/* .data section from executable. */
@@ -633,9 +639,7 @@ rs6000coff_core_p (abfd)
/* Return `TRUE' if given core is from the given executable. */
bfd_boolean
-rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd;
- bfd *exec_bfd;
+rs6000coff_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
{
CoreHdr core;
bfd_size_type size;
@@ -651,7 +655,7 @@ rs6000coff_core_file_matches_executable_
if (CORE_NEW (core))
c_loader = CNEW_LOADER (core.new);
else
- c_loader = (file_ptr) COLD_LOADER (core.old);
+ c_loader = (file_ptr) (ptr_to_uint) COLD_LOADER (core.old);
if (CORE_NEW (core) && CNEW_PROC64 (core.new))
size = (int) ((LdInfo *) 0)->l64.ldinfo_filename;
@@ -711,8 +715,7 @@ rs6000coff_core_file_matches_executable_
}
char *
-rs6000coff_core_file_failing_command (abfd)
- bfd *abfd;
+rs6000coff_core_file_failing_command (bfd *abfd)
{
CoreHdr *core = core_hdr (abfd);
char *com = CORE_NEW (*core) ?
@@ -725,8 +728,7 @@ rs6000coff_core_file_failing_command (ab
}
int
-rs6000coff_core_file_failing_signal (abfd)
- bfd *abfd;
+rs6000coff_core_file_failing_signal (bfd *abfd)
{
CoreHdr *core = core_hdr (abfd);
return CORE_NEW (*core) ? core->new.c_signo : core->old.c_signo;
Index: xcoff-target.h
===================================================================
RCS file: /cvs/src/src/bfd/xcoff-target.h,v
retrieving revision 1.15
diff -u -p -r1.15 xcoff-target.h
--- xcoff-target.h 4 May 2005 15:53:41 -0000 1.15
+++ xcoff-target.h 28 Oct 2005 00:44:52 -0000
@@ -63,8 +63,8 @@
#undef CORE_FILE_P
#define CORE_FILE_P rs6000coff_core_p
-extern const bfd_target * rs6000coff_core_p (void);
-extern bfd_boolean rs6000coff_core_file_matches_executable_p (void);
+extern const bfd_target * rs6000coff_core_p (bfd *);
+extern bfd_boolean rs6000coff_core_file_matches_executable_p (bfd *, bfd*);
#undef coff_core_file_matches_executable_p
#define coff_core_file_matches_executable_p \
More information about the Binutils
mailing list