From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20639 invoked by alias); 8 May 2009 20:32:05 -0000 Received: (qmail 20620 invoked by uid 22791); 8 May 2009 20:32:02 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 May 2009 20:31:55 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id AA4D82BAD26; Fri, 8 May 2009 16:31:53 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id y0UGmEnHhJjN; Fri, 8 May 2009 16:31:53 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 754592BAD25; Fri, 8 May 2009 16:31:53 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id A1078F5900; Fri, 8 May 2009 13:31:49 -0700 (PDT) Date: Fri, 08 May 2009 20:32:00 -0000 From: Joel Brobecker To: David Daney Cc: Pierre Muller , gdb-patches@sourceware.org Subject: Re: [RFA] Remove unecessary checks for macros in target.h Message-ID: <20090508203149.GK659@adacore.com> References: <003301c9cfe3$e7547ed0$b5fd7c70$@u-strasbg.fr> <4A046173.8030704@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A046173.8030704@caviumnetworks.com> User-Agent: Mutt/1.5.18 (2008-05-17) 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/msg00181.txt.bz2 > However, I do wonder if it would make sense to remove the macros > altogether, and just push the expansions down into the code. If we > really don't want to be able to switch in different implementations of > these things, what is the point of an added layer of abstraction? Eventually, we'll want these macros to be functions, I think. I'd personally like it if they all had the target_ops as the first parameter, so that the target function can find the "target beneath" and call its associated routine if needed. For instance: static void sol_thread_detach (struct target_ops *ops, char *args, int from_tty) { struct target_ops *beneath = find_target_beneath (ops); sol_thread_active = 0; inferior_ptid = pid_to_ptid (PIDGET (main_ph.ptid)); unpush_target (ops); beneath->to_detach (beneath, args, from_tty); } -- Joel