Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Subject: [pushed v2 2/4] Rename address_space_int_to_name/address_space_name_to_int
Date: Mon, 14 Sep 2020 22:31:10 +0100	[thread overview]
Message-ID: <20200914213112.19593-3-pedro@palves.net> (raw)
In-Reply-To: <20200914213112.19593-1-pedro@palves.net>

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/ChangeLog     | 14 ++++++++++++++
 gdb/c-typeprint.c |  5 +++--
 gdb/gdbtypes.c    | 16 ++++++++--------
 gdb/gdbtypes.h    |  8 ++++----
 gdb/type-stack.c  |  5 +++--
 gdb/type-stack.h  | 10 +++++-----
 6 files changed, 37 insertions(+), 21 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7d4800b0b0..cb435c1fd7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2020-09-14  Pedro Alves  <pedro@palves.net>
+
+	* 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.
+
 2020-09-14  Pedro Alves  <pedro@palves.net>
 	    Andrew Burgess  <andrew.burgess@embecosm.com>
 
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



  parent reply	other threads:[~2020-09-14 21:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-14 21:31 [pushed v2 0/4] Rewrite enum_flags, add unit tests, fix problems Pedro Alves
2020-09-14 21:31 ` [pushed v2 1/4] Use type_instance_flags more throughout Pedro Alves
2020-09-15  2:28   ` [pushed] gdb: remove TYPE_INSTANCE_FLAGS Simon Marchi
2020-09-15 21:28     ` Luis Machado
2020-09-16  2:50       ` Simon Marchi
2020-09-16 11:01         ` Pedro Alves
2020-09-16 20:44           ` Simon Marchi
2020-09-14 21:31 ` Pedro Alves [this message]
2020-09-14 21:31 ` [pushed v2 3/4] Rewrite valid-expr.h's internals in terms of the detection idiom (C++17/N4502) Pedro Alves
2020-09-17 10:57   ` Vaseeharan Vinayagamoorthy
2020-09-17 11:41     ` Luis Machado
2020-09-17 16:10     ` Vaseeharan Vinayagamoorthy
2020-09-17 16:23       ` Luis Machado
2020-09-14 21:31 ` [pushed v2 4/4] Rewrite enum_flags, add unit tests, fix problems Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200914213112.19593-3-pedro@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox