From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16605 invoked by alias); 6 Feb 2014 20:56:13 -0000 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 Received: (qmail 16506 invoked by uid 89); 6 Feb 2014 20:56:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Feb 2014 20:56:11 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s16Ku9Gw020199 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 6 Feb 2014 15:56:10 -0500 Received: from barimba.redhat.com (ovpn-113-148.phx2.redhat.com [10.3.113.148]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s16KtfZr013306; Thu, 6 Feb 2014 15:56:08 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFC v2 32/38] remove function casts from target.c Date: Thu, 06 Feb 2014 20:56:00 -0000 Message-Id: <1391720136-2121-33-git-send-email-tromey@redhat.com> In-Reply-To: <1391720136-2121-1-git-send-email-tromey@redhat.com> References: <1391720136-2121-1-git-send-email-tromey@redhat.com> X-SW-Source: 2014-02/txt/msg00150.txt.bz2 This cleans up target.c to avoid function casts. 2014-02-06 Tom Tromey * target.c (complete_target_initialization): Remove casts. Use return_zero_has_execution. (return_zero): Add "ignore" argument. (return_zero_has_execution): New function. (init_dummy_target): Remove casts. Use return_zero_has_execution. --- gdb/ChangeLog | 9 +++++++++ gdb/target.c | 33 ++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/gdb/target.c b/gdb/target.c index eded617..8de7487 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -77,7 +77,9 @@ static void tcomplain (void) ATTRIBUTE_NORETURN; static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *); -static int return_zero (void); +static int return_zero (struct target_ops *); + +static int return_zero_has_execution (struct target_ops *, ptid_t); void target_ignore (void); @@ -376,19 +378,19 @@ complete_target_initialization (struct target_ops *t) t->to_xfer_partial = default_xfer_partial; if (t->to_has_all_memory == NULL) - t->to_has_all_memory = (int (*) (struct target_ops *)) return_zero; + t->to_has_all_memory = return_zero; if (t->to_has_memory == NULL) - t->to_has_memory = (int (*) (struct target_ops *)) return_zero; + t->to_has_memory = return_zero; if (t->to_has_stack == NULL) - t->to_has_stack = (int (*) (struct target_ops *)) return_zero; + t->to_has_stack = return_zero; if (t->to_has_registers == NULL) - t->to_has_registers = (int (*) (struct target_ops *)) return_zero; + t->to_has_registers = return_zero; if (t->to_has_execution == NULL) - t->to_has_execution = (int (*) (struct target_ops *, ptid_t)) return_zero; + t->to_has_execution = return_zero_has_execution; install_delegators (t); } @@ -3185,7 +3187,13 @@ default_thread_architecture (struct target_ops *ops, ptid_t ptid) } static int -return_zero (void) +return_zero (struct target_ops *ignore) +{ + return 0; +} + +static int +return_zero_has_execution (struct target_ops *ignore, ptid_t ignore2) { return 0; } @@ -3300,12 +3308,11 @@ init_dummy_target (void) dummy_target.to_supports_disable_randomization = find_default_supports_disable_randomization; dummy_target.to_stratum = dummy_stratum; - dummy_target.to_has_all_memory = (int (*) (struct target_ops *)) return_zero; - dummy_target.to_has_memory = (int (*) (struct target_ops *)) return_zero; - dummy_target.to_has_stack = (int (*) (struct target_ops *)) return_zero; - dummy_target.to_has_registers = (int (*) (struct target_ops *)) return_zero; - dummy_target.to_has_execution - = (int (*) (struct target_ops *, ptid_t)) return_zero; + dummy_target.to_has_all_memory = return_zero; + dummy_target.to_has_memory = return_zero; + dummy_target.to_has_stack = return_zero; + dummy_target.to_has_registers = return_zero; + dummy_target.to_has_execution = return_zero_has_execution; dummy_target.to_magic = OPS_MAGIC; install_dummy_methods (&dummy_target); -- 1.8.1.4