Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] Use %p conversion specifier to fix hppa compiler warning
@ 2005-06-12 21:02 Mark Kettenis
  2005-06-13  6:12 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Kettenis @ 2005-06-12 21:02 UTC (permalink / raw)
  To: gdb-patches

Currently the compiler warns about hppa_pointer_to_address_hack().
Rather than adding ugly casts and making this an even worse hack, I
propose to remove it completely in favour of using the %p format
specifier.

In the past we didn't use the %p conversion specifier since it wasn't
portable; ancient UNIX didn't support it.  However, I'm confident that
we do not support those systems any more.  I've done some archeology,
and it seems %p is supported by Ultrix 4.0, HP-UX 10.01 and SunOS
4.1.3.

Unless people object, I'll commit the attached patch next weekend.
I'll also try to find all other %p workarounds in the code and get rid
of those.

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* hppa-tdep.c (hppa_pointer_to_address_hack): Remove function.
	(unwind_command): Use %p to print pointer.

Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.207
diff -u -p -r1.207 hppa-tdep.c
--- hppa-tdep.c 12 Jun 2005 19:54:25 -0000 1.207
+++ hppa-tdep.c 12 Jun 2005 20:53:59 -0000
@@ -2402,16 +2402,6 @@ hppa_lookup_stub_minimal_symbol (const c
   return NULL;
 }
 
-/* Instead of this nasty cast, add a method pvoid() that prints out a
-   host VOID data type (remember %p isn't portable).  */
-
-static CORE_ADDR
-hppa_pointer_to_address_hack (void *ptr)
-{
-  gdb_assert (sizeof (ptr) == TYPE_LENGTH (builtin_type_void_data_ptr));
-  return POINTER_TO_ADDRESS (builtin_type_void_data_ptr, &ptr);
-}
-
 static void
 unwind_command (char *exp, int from_tty)
 {
@@ -2433,8 +2423,7 @@ unwind_command (char *exp, int from_tty)
       return;
     }
 
-  printf_unfiltered ("unwind_table_entry (0x%s):\n",
-		     paddr_nz (hppa_pointer_to_address_hack (u)));
+  printf_unfiltered ("unwind_table_entry (%p):\n", u);
 
   printf_unfiltered ("\tregion_start = ");
   print_address (u->region_start, gdb_stdout);


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-06-19 21:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-12 21:02 [RFC] Use %p conversion specifier to fix hppa compiler warning Mark Kettenis
2005-06-13  6:12 ` Eli Zaretskii
2005-06-19 21:31   ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox