From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18544 invoked by alias); 7 Jan 2014 20:38:08 -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 18522 invoked by uid 89); 7 Jan 2014 20:38:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: mail-out.m-online.net Received: from mail-out.m-online.net (HELO mail-out.m-online.net) (212.18.0.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 07 Jan 2014 20:38:06 +0000 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3dzQQL6Pxlz3hjMZ for ; Tue, 7 Jan 2014 21:38:02 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3dzQQL6JxRzbbft for ; Tue, 7 Jan 2014 21:38:02 +0100 (CET) Received: from mail.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id XmtS4An4fdhZ for ; Tue, 7 Jan 2014 21:38:01 +0100 (CET) X-Auth-Info: fMjxxHeILAwPlONC7ItE7ylUHffdyZbqgGDS5X7kXnc= Received: from igel.home (ppp-88-217-48-150.dynamic.mnet-online.de [88.217.48.150]) by mail.mnet-online.de (Postfix) with ESMTPA for ; Tue, 7 Jan 2014 21:38:01 +0100 (CET) Received: by igel.home (Postfix, from userid 1000) id 55EA32C162B; Tue, 7 Jan 2014 21:38:01 +0100 (CET) From: Andreas Schwab To: gdb-patches@sourceware.org Subject: [PATCH] Use correct default for target functions that return pointer X-Yow: Let's climb to the TOP of that MOUNTAIN and think about STRIP MINING!! Date: Tue, 07 Jan 2014 20:38:00 -0000 Message-ID: <871u0jbk9i.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2014-01/txt/msg00164.txt.bz2 It is wrong to use a function that returns an int as a placeholder for a function that returns a pointer. Andreas. * target.c (return_null): Define. (update_current_target): Use it instead of return_zero for functions that return a pointer. --- gdb/target.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gdb/target.c b/gdb/target.c index 65c7a7a..42a8741 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -64,6 +64,8 @@ static int return_one (void); static int return_minus_one (void); +static void *return_null (void); + void target_ignore (void); static void target_command (char *, int); @@ -806,10 +808,10 @@ update_current_target (void) return_zero); de_fault (to_extra_thread_info, (char *(*) (struct thread_info *)) - return_zero); + return_null); de_fault (to_thread_name, (char *(*) (struct thread_info *)) - return_zero); + return_null); de_fault (to_stop, (void (*) (ptid_t)) target_ignore); @@ -819,7 +821,7 @@ update_current_target (void) tcomplain); de_fault (to_pid_to_exec_file, (char *(*) (int)) - return_zero); + return_null); de_fault (to_async, (void (*) (void (*) (enum inferior_event_type, void*), void*)) tcomplain); @@ -918,7 +920,7 @@ update_current_target (void) tcomplain); de_fault (to_traceframe_info, (struct traceframe_info * (*) (void)) - return_zero); + return_null); de_fault (to_supports_evaluation_of_breakpoint_conditions, (int (*) (void)) return_zero); @@ -3634,6 +3636,12 @@ return_minus_one (void) return -1; } +static void * +return_null (void) +{ + return 0; +} + /* * Find the next target down the stack from the specified target. */ -- 1.8.5.2 -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."