From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by sourceware.org (Postfix) with ESMTPS id CF716396DC07 for ; Mon, 14 Sep 2020 19:26:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CF716396DC07 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=alves.ped@gmail.com Received: by mail-wm1-f66.google.com with SMTP id e11so9524594wme.0 for ; Mon, 14 Sep 2020 12:26:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=o6C2TMGrl5TNekhhf4gdWTs2HhE+hDtd4AK8sqhuQbA=; b=UhvMrJWkLg7hdL25IyMVmXeJYLEupuPeeQyHa0sm/Lu/B76VVigrEe2Cye0Ja3ZB8C orWrAkCBBXioDuThXSIwk3c3Qed5mgTkBnCxcGj0ZMVc3fYFUilcmQF7cstk9p5ORmqi aj7E3m1eguqeJBn9UXA7r/IdyyDjMZzLHVn+Pp38tPnMcRZ/CUCgBC5mtG6peWTzlBgL y2kTDA6llFBnbJ0Qq3iL4NR+MAVbIzM41C0vY7jvWA/W5+dxnq/zGQrazkQzgQCIIaVC 9snNgb4HI/JyF5Yyg43RZIbpV13aM48R2DoffrOFsPZSVGP/YsXi3cX5hgjhETCC2YoO 7Xuw== X-Gm-Message-State: AOAM533Wacv6LVe/pt837CXgTexcxhF7xwGcCBUM25EbaDFmysXhdTtu XqYK6kaQfHHehvVBoc/L8a2W/snwgNsoSA== X-Google-Smtp-Source: ABdhPJzM8ND7GskRfwr6xTeW6SFB2pzYj6urf72/oWsLDTw0ydCp7tvPFZPECxkL/Ie9sbORuYUkDA== X-Received: by 2002:a1c:9c13:: with SMTP id f19mr819558wme.97.1600111566178; Mon, 14 Sep 2020 12:26:06 -0700 (PDT) Received: from ?IPv6:2001:8a0:f905:5600:eefd:c63:53e0:3e8a? ([2001:8a0:f905:5600:eefd:c63:53e0:3e8a]) by smtp.gmail.com with ESMTPSA id c4sm22273567wrp.85.2020.09.14.12.26.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Sep 2020 12:26:04 -0700 (PDT) Subject: Re: [PATCH 2/3] Use type_instance_flags more throughout To: Tom Tromey References: <20200821144523.19451-1-pedro@palves.net> <20200821144523.19451-3-pedro@palves.net> <87y2lgf4im.fsf@tromey.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <52c5c863-7dc9-c05e-374e-e060cad2e621@palves.net> Date: Mon, 14 Sep 2020 20:26:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <87y2lgf4im.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP 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: Mon, 14 Sep 2020 19:26:10 -0000 On 9/11/20 9:21 PM, Tom Tromey wrote: >>>>>> "Pedro" == Pedro Alves writes: > > Pedro> -int > Pedro> +type_instance_flags > Pedro> address_space_name_to_int (struct gdbarch *gdbarch, > > Maybe this is misnamed after the change. > > Pedro> const char * > Pedro> -address_space_int_to_name (struct gdbarch *gdbarch, int space_flag) > Pedro> +address_space_int_to_name (struct gdbarch *gdbarch, > > Likewise. Yeah, I wasn't sure it was worth it. I'm adding this patch to the series to address this. >From 924d1538efdfbc2241cbab0c2ad91abbb0921fde Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 14 Sep 2020 19:53:18 +0100 Subject: [PATCH] Rename address_space_int_to_name/address_space_name_to_int These methods now take/return a type_instance_flags instead of a raw integer, so rename them accordingly. gdb/ChangeLog: * c-typeprint.c (c_type_print_modifier): Adjust to rename. * gdbtypes.c (address_space_name_to_int): Rename to ... (address_space_name_to_type_instance_flags): ... this. (address_space_int_to_name): Rename to ... (address_space_type_instance_flags_to_name): ... this. * gdbtypes.h (address_space_name_to_int): Rename to ... (address_space_name_to_type_instance_flags): ... this. (address_space_int_to_name): Rename to ... (address_space_type_instance_flags_to_name): ... this. * type-stack.c (type_stack::insert): Adjust to rename. * type-stack.h (type_stack::insert): Likewise. --- gdb/c-typeprint.c | 5 +++-- gdb/gdbtypes.c | 16 ++++++++-------- gdb/gdbtypes.h | 8 ++++---- gdb/type-stack.c | 5 +++-- gdb/type-stack.h | 10 +++++----- 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index b642c88178..a07b29a95d 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -526,8 +526,9 @@ c_type_print_modifier (struct type *type, struct ui_file *stream, did_print_modifier = 1; } - address_space_id = address_space_int_to_name (get_type_arch (type), - TYPE_INSTANCE_FLAGS (type)); + address_space_id + = address_space_type_instance_flags_to_name (get_type_arch (type), + TYPE_INSTANCE_FLAGS (type)); if (address_space_id) { if (did_print_modifier || need_pre_space) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index b57353dec3..7ade2ccb53 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -575,12 +575,12 @@ lookup_function_type_with_arguments (struct type *type, return fn; } -/* Identify address space identifier by name -- - return the integer flag defined in gdbtypes.h. */ +/* Identify address space identifier by name -- return a + type_instance_flags. */ type_instance_flags -address_space_name_to_int (struct gdbarch *gdbarch, - const char *space_identifier) +address_space_name_to_type_instance_flags (struct gdbarch *gdbarch, + const char *space_identifier) { type_instance_flags type_flags; @@ -598,12 +598,12 @@ address_space_name_to_int (struct gdbarch *gdbarch, error (_("Unknown address space specifier: \"%s\""), space_identifier); } -/* Identify address space identifier by integer flag as defined in - gdbtypes.h -- return the string version of the adress space name. */ +/* Identify address space identifier by type_instance_flags and return + the string version of the adress space name. */ const char * -address_space_int_to_name (struct gdbarch *gdbarch, - type_instance_flags space_flag) +address_space_type_instance_flags_to_name (struct gdbarch *gdbarch, + type_instance_flags space_flag) { if (space_flag & TYPE_INSTANCE_FLAG_CODE_SPACE) return "code"; diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index cdd136ef52..6b87de307b 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -2217,11 +2217,11 @@ extern struct type *make_atomic_type (struct type *); extern void replace_type (struct type *, struct type *); -extern type_instance_flags address_space_name_to_int (struct gdbarch *, - const char *); +extern type_instance_flags address_space_name_to_type_instance_flags + (struct gdbarch *, const char *); -extern const char *address_space_int_to_name (struct gdbarch *, - type_instance_flags); +extern const char *address_space_type_instance_flags_to_name + (struct gdbarch *, type_instance_flags); extern struct type *make_type_with_address_space (struct type *type, type_instance_flags space_identifier); diff --git a/gdb/type-stack.c b/gdb/type-stack.c index 608142c849..94ff9ba8c9 100644 --- a/gdb/type-stack.c +++ b/gdb/type-stack.c @@ -67,8 +67,9 @@ type_stack::insert (struct expr_builder *pstate, const char *string) element.piece = tp_space_identifier; insert_into (slot, element); - element.int_val = address_space_name_to_int (pstate->gdbarch (), - string); + element.int_val + = address_space_name_to_type_instance_flags (pstate->gdbarch (), + string); insert_into (slot, element); } diff --git a/gdb/type-stack.h b/gdb/type-stack.h index 8060f2fea7..265178fc37 100644 --- a/gdb/type-stack.h +++ b/gdb/type-stack.h @@ -157,11 +157,11 @@ struct type_stack /* Insert a tp_space_identifier and the corresponding address space value into the stack. STRING is the name of an address space, as - recognized by address_space_name_to_int. If the stack is empty, - the new elements are simply pushed. If the stack is not empty, - this function assumes that the first item on the stack is a - tp_pointer, and the new values are inserted above the first - item. */ + recognized by address_space_name_to_type_instance_flags. If the + stack is empty, the new elements are simply pushed. If the stack + is not empty, this function assumes that the first item on the + stack is a tp_pointer, and the new values are inserted above the + first item. */ void insert (struct expr_builder *pstate, const char *string); -- 2.14.5