From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26677 invoked by alias); 12 Jun 2005 21:02:25 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 26669 invoked by uid 22791); 12 Jun 2005 21:02:22 -0000 Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Sun, 12 Jun 2005 21:02:22 +0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.0/8.13.0) with ESMTP id j5CL2KnW008677 for ; Sun, 12 Jun 2005 23:02:20 +0200 (CEST) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.4/8.13.3) with ESMTP id j5CL2JxN004308 for ; Sun, 12 Jun 2005 23:02:19 +0200 (CEST) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.4/8.13.4/Submit) id j5CL2FPB002032; Sun, 12 Jun 2005 23:02:15 +0200 (CEST) Date: Sun, 12 Jun 2005 21:02:00 -0000 Message-Id: <200506122102.j5CL2FPB002032@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: gdb-patches@sources.redhat.com Subject: [RFC] Use %p conversion specifier to fix hppa compiler warning X-SW-Source: 2005-06/txt/msg00135.txt.bz2 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 * 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);