This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[commit] Fix compilation warning in procfs.c on mips-irix


While I was building GDB on mips-irix, I noticed a couple of warnings, 
so I decided to fix them.

On mips-irix, the pr_vaddr field is a caddr, and apparently, CORE_ADDR
is not the same size as this type.  So we need to cast it to an integer
type with the same size first, and then to CORE_ADDR.

2009-04-16  Joel Brobecker  <brobecker@adacore.com>

        * procfs.c (solib_mappings_callback, find_memory_regions_callback):
        Fix a compilation warning on mips-irix due to casting from
        a pointer of different size.

I actually meant to post this patch and wait for a few days before
checking in, but I accidently did the checkin. I'm pretty sure it's OK,
but let me know if not, and I'll revert.

-- 
Joel
commit b39e37470c731a5a201a3466ff01aad38b3d4f36
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Wed Apr 8 15:02:40 2009 -0700

        * procfs.c (solib_mappings_callback, find_memory_regions_callback):
        Fix a compilation warning on mips-irix due to casting from
        a pointer of different size.

diff --git a/gdb/procfs.c b/gdb/procfs.c
index adb44f4..36d0e47 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -5473,7 +5473,7 @@ int solib_mappings_callback (struct prmap *map,
      no file, so the ioctl may return failure, but that's
      not a problem.  */
 #endif
-  return (*func) (fd, (CORE_ADDR) map->pr_vaddr);
+  return (*func) (fd, (CORE_ADDR) (uintptr_t) map->pr_vaddr);
 }
 
 /*
@@ -5524,7 +5524,7 @@ find_memory_regions_callback (struct prmap *map,
 					   void *),
 			      void *data)
 {
-  return (*func) ((CORE_ADDR) map->pr_vaddr,
+  return (*func) ((CORE_ADDR) (uintptr_t) map->pr_vaddr,
 		  map->pr_size,
 		  (map->pr_mflags & MA_READ) != 0,
 		  (map->pr_mflags & MA_WRITE) != 0,

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