From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) by sourceware.org (Postfix) with ESMTPS id 97ECB393741C for ; Tue, 17 Mar 2020 19:00:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 97ECB393741C Received: by mail-oi1-x242.google.com with SMTP id b17so8027786oic.8 for ; Tue, 17 Mar 2020 12:00:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HaqlTmubT4UlfA0Y4KZ7GG8oFg4prbhNDLl95B1A+wA=; b=g5nbuU4N8bV85vYSeVa7AdIO+tc2dFbuaZw9lUmN69O3eAXO5j+GQdVMoQJDJ6PHso j39VE1zhVPyMPSKEzPX6jDv2l9Ms9JfOjLuvkKAFJJY7ilnvtKcwneBUy+Dwu2cvKrH8 2pmQGSpNEkTlF16OoarmiXdvLRkA5acseYfJav0leYKacFwRsVVIurGPUtCK/e+6P9tH Ox4W+ejslgS6l63VELWDU93VJCyxErR6ENPYKnAEXM/8im0cP4uMuiotoLbLfW5tyIiG rWxToyWXmWPLlBhFXIqbru30ouCWTeBHXWisNWyxP4HTZGRTeeYerrljAbpZi2DGUe2v V4+g== X-Gm-Message-State: ANhLgQ2XzXa8wODiUc13qgGVnEIsmhlWfhS6OyAjdMIjaEfzTFVJGwhO 7EvapxqGt7uaCDTn/188kiOiMSzapW5vSZMeYTImOduW X-Google-Smtp-Source: ADFU+vsdPvub8OJPRhqDfEde4ygjhB/fKgpPmVzNNpcC0ZX7OVmQlLltCd6IX07TmTjCKUSm69sujNIg0TVQ++wvE7A= X-Received: by 2002:aca:4a86:: with SMTP id x128mr280003oia.29.1584471624549; Tue, 17 Mar 2020 12:00:24 -0700 (PDT) MIME-Version: 1.0 References: <20200317124532.22151-1-n54@gmx.com> <4f0eed4e-c649-a901-f0e5-c7dbfe65c8fd@gmx.com> In-Reply-To: <4f0eed4e-c649-a901-f0e5-c7dbfe65c8fd@gmx.com> From: Christian Biesinger Date: Tue, 17 Mar 2020 13:59:47 -0500 Message-ID: Subject: Re: [PATCH] Rename the read symbol to xread To: Kamil Rytarowski Cc: gdb-patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-40.7 required=5.0 tests=DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Mar 2020 19:00:26 -0000 On Tue, Mar 17, 2020 at 1:02 PM Kamil Rytarowski wrote: > > On 17.03.2020 19:00, Christian Biesinger wrote: > > On Tue, Mar 17, 2020 at 12:59 PM Kamil Rytarowski wrote: > >> > >> On 17.03.2020 18:51, Christian Biesinger wrote: > >>> On Tue, Mar 17, 2020 at 7:46 AM Kamil Rytarowski wrote: > >>>> > >>>> This avoids clashes with macro read in the NetBSD headers. > >>> > >>> Out of curiosity, what does NetBSD define read to? > >>> > >>> I think it would be useful to add a comment saying why this is called xread. > >>> > >> > >> NetBSD ships with SSP (stack smashing protector) support that > >> conditionally redefines read(2). > >> > >> https://github.com/NetBSD/src/blob/trunk/include/ssp/unistd.h#L39 > > > > Ah thanks. > > > >> Is a comment in the commit message enough? > > > > Not IMO, that's much harder to find... > > > > Where should I document this? in struct_reg? I'd put it above the declaration in user_reg, ... > > > Christian > > > >>> Christian > >>> > >>>> --- > >>>> gdb/user-regs.c | 18 +++++++++--------- > >>>> 1 file changed, 9 insertions(+), 9 deletions(-) > >>>> > >>>> diff --git a/gdb/user-regs.c b/gdb/user-regs.c > >>>> index a232b1eb000..a968a18bc23 100644 > >>>> --- a/gdb/user-regs.c > >>>> +++ b/gdb/user-regs.c > >>>> @@ -41,7 +41,7 @@ > >>>> struct user_reg > >>>> { > >>>> const char *name; > >>>> - struct value *(*read) (struct frame_info * frame, const void *baton); > >>>> + struct value *(*xread) (struct frame_info * frame, const void *baton); ... above this line. > >>>> const void *baton; > >>>> struct user_reg *next; > >>>> }; > >>>> @@ -60,7 +60,7 @@ struct gdb_user_regs > >>>> > >>>> static void > >>>> append_user_reg (struct gdb_user_regs *regs, const char *name, > >>>> - user_reg_read_ftype *read, const void *baton, > >>>> + user_reg_read_ftype *xread, const void *baton, > >>>> struct user_reg *reg) > >>>> { > >>>> /* The caller is responsible for allocating memory needed to store > >>>> @@ -68,7 +68,7 @@ append_user_reg (struct gdb_user_regs *regs, const char *name, > >>>> register list stored in the common heap or a specific obstack. */ > >>>> gdb_assert (reg != NULL); > >>>> reg->name = name; > >>>> - reg->read = read; > >>>> + reg->xread = xread; > >>>> reg->baton = baton; > >>>> reg->next = NULL; > >>>> (*regs->last) = reg; > >>>> @@ -82,10 +82,10 @@ static struct gdb_user_regs builtin_user_regs = { > >>>> }; > >>>> > >>>> void > >>>> -user_reg_add_builtin (const char *name, user_reg_read_ftype *read, > >>>> +user_reg_add_builtin (const char *name, user_reg_read_ftype *xread, > >>>> const void *baton) > >>>> { > >>>> - append_user_reg (&builtin_user_regs, name, read, baton, > >>>> + append_user_reg (&builtin_user_regs, name, xread, baton, > >>>> XNEW (struct user_reg)); > >>>> } > >>>> > >>>> @@ -103,14 +103,14 @@ user_regs_init (struct gdbarch *gdbarch) > >>>> > >>>> regs->last = ®s->first; > >>>> for (reg = builtin_user_regs.first; reg != NULL; reg = reg->next) > >>>> - append_user_reg (regs, reg->name, reg->read, reg->baton, > >>>> + append_user_reg (regs, reg->name, reg->xread, reg->baton, > >>>> GDBARCH_OBSTACK_ZALLOC (gdbarch, struct user_reg)); > >>>> return regs; > >>>> } > >>>> > >>>> void > >>>> user_reg_add (struct gdbarch *gdbarch, const char *name, > >>>> - user_reg_read_ftype *read, const void *baton) > >>>> + user_reg_read_ftype *xread, const void *baton) > >>>> { > >>>> struct gdb_user_regs *regs > >>>> = (struct gdb_user_regs *) gdbarch_data (gdbarch, user_regs_data); > >>>> @@ -122,7 +122,7 @@ user_reg_add (struct gdbarch *gdbarch, const char *name, > >>>> regs = (struct gdb_user_regs *) user_regs_init (gdbarch); > >>>> deprecated_set_gdbarch_data (gdbarch, user_regs_data, regs); > >>>> } > >>>> - append_user_reg (regs, name, read, baton, > >>>> + append_user_reg (regs, name, xread, baton, > >>>> GDBARCH_OBSTACK_ZALLOC (gdbarch, struct user_reg)); > >>>> } > >>>> > >>>> @@ -214,7 +214,7 @@ value_of_user_reg (int regnum, struct frame_info *frame) > >>>> struct user_reg *reg = usernum_to_user_reg (gdbarch, regnum - maxregs); > >>>> > >>>> gdb_assert (reg != NULL); > >>>> - return reg->read (frame, reg->baton); > >>>> + return reg->xread (frame, reg->baton); > >>>> } > >>>> > >>>> static void > >>>> -- > >>>> 2.25.0 > >>>> > >> > >> > >