From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6966 invoked by alias); 14 May 2009 11:33:09 -0000 Received: (qmail 6957 invoked by uid 22791); 14 May 2009 11:33:08 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mtagate7.de.ibm.com (HELO mtagate7.de.ibm.com) (195.212.29.156) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 14 May 2009 11:33:01 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate7.de.ibm.com (8.14.3/8.13.8) with ESMTP id n4EBWwxo427992 for ; Thu, 14 May 2009 11:32:58 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n4EBWw0B3895436 for ; Thu, 14 May 2009 13:32:58 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n4EBWwob030717 for ; Thu, 14 May 2009 13:32:58 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id n4EBWvpC030704 for ; Thu, 14 May 2009 13:32:57 +0200 Message-Id: <200905141132.n4EBWvpC030704@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Thu, 14 May 2009 13:32:57 +0200 Subject: [rfc] Remove deprecated_extract/store_floating To: gdb-patches@sourceware.org Date: Thu, 14 May 2009 11:33:00 -0000 From: "Ulrich Weigand" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-05/txt/msg00293.txt.bz2 Hello, this patch removes the old deprecated_extract_floating and deprecated_store_floating routines. There was one remaining use in sh64-tdep.c, which seems an oversight and is trivially replacable by extract_typed_floating. In addition, the patch inlines the extract_floating_by_length and store_floating_by_length into their callers, which leads to some simplification of the doublest.c code. Tested on powerpc64-linux with no regression. I'm planning on committing this patch in a couple of days. Bye, Ulrich ChangeLog: * doublest.c (NAN): Remove unused define. (extract_floating_by_length, deprecated_extract_floating): Remove. (store_floating_by_length, deprecated_store_floating): Remove. (extract_typed_floating): Do not call extract_floating_by_length. (store_typed_floating): Do not call store_floating_by_length. (convert_typed_floating): Remove redundant assertions. * doublest.h (deprecated_extract_floating): Remove. (deprecated_store_floating): Remove. * sh64-tdep.c (sh64_register_convert_to_raw): Call extract_typed_floating instead of deprecated_extract_floating. Index: gdb-head/gdb/doublest.c =================================================================== --- gdb-head.orig/gdb/doublest.c +++ gdb-head/gdb/doublest.c @@ -800,65 +800,16 @@ floatformat_from_type (const struct type return floatformat_from_length (TYPE_LENGTH (type)); } -/* If the host doesn't define NAN, use zero instead. */ -#ifndef NAN -#define NAN 0.0 -#endif - -/* Extract a floating-point number of length LEN from a target-order - byte-stream at ADDR. Returns the value as type DOUBLEST. */ - -static DOUBLEST -extract_floating_by_length (const void *addr, int len) -{ - const struct floatformat *fmt = floatformat_from_length (len); - DOUBLEST val; - - floatformat_to_doublest (fmt, addr, &val); - return val; -} - -DOUBLEST -deprecated_extract_floating (const void *addr, int len) -{ - return extract_floating_by_length (addr, len); -} - -/* Store VAL as a floating-point number of length LEN to a - target-order byte-stream at ADDR. */ - -static void -store_floating_by_length (void *addr, int len, DOUBLEST val) -{ - const struct floatformat *fmt = floatformat_from_length (len); - - floatformat_from_doublest (fmt, &val, addr); -} - -void -deprecated_store_floating (void *addr, int len, DOUBLEST val) -{ - store_floating_by_length (addr, len, val); -} - /* Extract a floating-point number of type TYPE from a target-order byte-stream at ADDR. Returns the value as type DOUBLEST. */ DOUBLEST extract_typed_floating (const void *addr, const struct type *type) { + const struct floatformat *fmt = floatformat_from_type (type); DOUBLEST retval; - gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT); - - if (TYPE_FLOATFORMAT (type) == NULL) - /* Not all code remembers to set the FLOATFORMAT (language - specific code? stabs?) so handle that here as a special case. */ - return extract_floating_by_length (addr, TYPE_LENGTH (type)); - - floatformat_to_doublest - (TYPE_FLOATFORMAT (type)[gdbarch_byte_order (current_gdbarch)], - addr, &retval); + floatformat_to_doublest (fmt, addr, &retval); return retval; } @@ -868,7 +819,7 @@ extract_typed_floating (const void *addr void store_typed_floating (void *addr, const struct type *type, DOUBLEST val) { - gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT); + const struct floatformat *fmt = floatformat_from_type (type); /* FIXME: kettenis/2001-10-28: It is debatable whether we should zero out any remaining bytes in the target buffer when TYPE is @@ -890,14 +841,7 @@ store_typed_floating (void *addr, const See also the function convert_typed_floating below. */ memset (addr, 0, TYPE_LENGTH (type)); - if (TYPE_FLOATFORMAT (type) == NULL) - /* Not all code remembers to set the FLOATFORMAT (language - specific code? stabs?) so handle that here as a special case. */ - store_floating_by_length (addr, TYPE_LENGTH (type), val); - else - floatformat_from_doublest - (TYPE_FLOATFORMAT (type)[gdbarch_byte_order (current_gdbarch)], - &val, addr); + floatformat_from_doublest (fmt, &val, addr); } /* Convert a floating-point number of type FROM_TYPE from a @@ -911,9 +855,6 @@ convert_typed_floating (const void *from const struct floatformat *from_fmt = floatformat_from_type (from_type); const struct floatformat *to_fmt = floatformat_from_type (to_type); - gdb_assert (TYPE_CODE (from_type) == TYPE_CODE_FLT); - gdb_assert (TYPE_CODE (to_type) == TYPE_CODE_FLT); - if (from_fmt == NULL || to_fmt == NULL) { /* If we don't know the floating-point format of FROM_TYPE or Index: gdb-head/gdb/doublest.h =================================================================== --- gdb-head.orig/gdb/doublest.h +++ gdb-head/gdb/doublest.h @@ -85,17 +85,6 @@ extern enum float_kind floatformat_class extern const char *floatformat_mantissa (const struct floatformat *, const bfd_byte *); -/* These functions have been replaced by extract_typed_floating and - store_typed_floating. - - Most calls are passing in TYPE_LENGTH (TYPE) so can be changed to - just pass the TYPE. The remainder pass in the length of a - register, those calls should instead pass in the floating point - type that corresponds to that length. */ - -extern DOUBLEST deprecated_extract_floating (const void *addr, int len); -extern void deprecated_store_floating (void *addr, int len, DOUBLEST val); - /* Given TYPE, return its floatformat. TYPE_FLOATFORMAT() may return NULL. type_floatformat() detects that and returns a floatformat based on the type size when FLOATFORMAT is NULL. */ Index: gdb-head/gdb/sh64-tdep.c =================================================================== --- gdb-head.orig/gdb/sh64-tdep.c +++ gdb-head/gdb/sh64-tdep.c @@ -1577,7 +1577,7 @@ sh64_register_convert_to_raw (struct gdb || (regnum >= DR0_C_REGNUM && regnum <= DR_LAST_C_REGNUM)) { - DOUBLEST val = deprecated_extract_floating (from, TYPE_LENGTH(type)); + DOUBLEST val = extract_typed_floating (from, type); floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, &val, to); } -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com