public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Remove gdbarch parameter of lookup_typename
@ 2019-12-05 20:04 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2019-12-05 20:04 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b858499daf0a824a518bac8bc13495ad856ab10d

commit b858499daf0a824a518bac8bc13495ad856ab10d
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Thu Dec 5 13:44:30 2019 -0500

    Remove gdbarch parameter of lookup_typename
    
    I noticed that the gdbarch parameter of lookup_typename was unused, so I
    removed it (as well as from lookup_signed_typename and
    lookup_unsigned_typename) and updated all callers.
    
    Tested by rebuilding.
    
    gdb/ChangeLog:
    
    	* c-exp.y: Update calls to lookup_typename,
    	lookup_signed_typename and lookup_unsigned_typename.
    	* c-lang.c (evaluate_subexp_c): Likewise.
    	* cp-namespace.c (cp_lookup_symbol_imports_or_template):
    	Likewise.
    	* eval.c (binop_promote): Likewise.
    	* gdbtypes.c (lookup_typename): Remove gdbarch parameter.
    	(lookup_unsigned_typename): Likewise.
    	(lookup_signed_typename): Likewise.
    	* gdbtypes.h (lookup_unsigned_typename): Likewise.
    	(lookup_signed_typename): Likewise.
    	(lookup_typename): Likewise.
    	* guile/scm-type.c (tyscm_lookup_typename): Update calls to
    	lookup_typename, lookup_signed_typename,
    	lookup_unsigned_typename.
    	* m2-exp.y: Likewise.
    	* printcmd.c (printf_wide_c_string): Likewise.
    	(ui_printf): Likewise.
    	* python/py-type.c (typy_lookup_typename): Likewise.
    	* python/py-xmethods.c (python_xmethod_worker::invoke):
    	Likewise.
    	* rust-exp.y: Likewise.

Diff:
---
 gdb/ChangeLog            | 25 +++++++++++++++++++++++++
 gdb/c-exp.y              | 36 ------------------------------------
 gdb/c-lang.c             |  9 +++------
 gdb/cp-namespace.c       |  3 +--
 gdb/eval.c               | 12 ++++++------
 gdb/gdbtypes.c           | 13 ++++++-------
 gdb/gdbtypes.h           |  7 +++----
 gdb/guile/scm-type.c     |  2 +-
 gdb/m2-exp.y             |  3 +--
 gdb/printcmd.c           |  4 ++--
 gdb/python/py-type.c     |  2 +-
 gdb/python/py-xmethods.c |  2 +-
 gdb/rust-exp.y           |  2 +-
 13 files changed, 51 insertions(+), 69 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 92ee52b..c6f7909 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,28 @@
+2019-12-05  Simon Marchi  <simon.marchi@polymtl.ca>
+
+	* c-exp.y: Update calls to lookup_typename,
+	lookup_signed_typename and lookup_unsigned_typename.
+	* c-lang.c (evaluate_subexp_c): Likewise.
+	* cp-namespace.c (cp_lookup_symbol_imports_or_template):
+	Likewise.
+	* eval.c (binop_promote): Likewise.
+	* gdbtypes.c (lookup_typename): Remove gdbarch parameter.
+	(lookup_unsigned_typename): Likewise.
+	(lookup_signed_typename): Likewise.
+	* gdbtypes.h (lookup_unsigned_typename): Likewise.
+	(lookup_signed_typename): Likewise.
+	(lookup_typename): Likewise.
+	* guile/scm-type.c (tyscm_lookup_typename): Update calls to
+	lookup_typename, lookup_signed_typename,
+	lookup_unsigned_typename.
+	* m2-exp.y: Likewise.
+	* printcmd.c (printf_wide_c_string): Likewise.
+	(ui_printf): Likewise.
+	* python/py-type.c (typy_lookup_typename): Likewise.
+	* python/py-xmethods.c (python_xmethod_worker::invoke):
+	Likewise.
+	* rust-exp.y: Likewise.
+
 2019-12-04  Christian Biesinger  <cbiesinger@google.com>
 
 	* configure.nat (obsd64): Add missing files x86-nat.o and
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 0ec6b19..fb806a8 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -824,7 +824,6 @@ exp	:	SIZEOF '(' type ')'	%prec UNARY
 			  write_exp_elt_opcode (pstate, OP_LONG);
 			  write_exp_elt_type (pstate, lookup_signed_typename
 					      (pstate->language (),
-					       pstate->gdbarch (),
 					       "int"));
 			  type = check_typedef (type);
 
@@ -1301,117 +1300,89 @@ typebase
 			{ $$ = $1.type; }
 	|	INT_KEYWORD
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "int"); }
 	|	LONG
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "long"); }
 	|	SHORT
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "short"); }
 	|	LONG INT_KEYWORD
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "long"); }
 	|	LONG SIGNED_KEYWORD INT_KEYWORD
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "long"); }
 	|	LONG SIGNED_KEYWORD
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "long"); }
 	|	SIGNED_KEYWORD LONG INT_KEYWORD
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "long"); }
 	|	UNSIGNED LONG INT_KEYWORD
 			{ $$ = lookup_unsigned_typename (pstate->language (),
-							 pstate->gdbarch (),
 							 "long"); }
 	|	LONG UNSIGNED INT_KEYWORD
 			{ $$ = lookup_unsigned_typename (pstate->language (),
-							 pstate->gdbarch (),
 							 "long"); }
 	|	LONG UNSIGNED
 			{ $$ = lookup_unsigned_typename (pstate->language (),
-							 pstate->gdbarch (),
 							 "long"); }
 	|	LONG LONG
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "long long"); }
 	|	LONG LONG INT_KEYWORD
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "long long"); }
 	|	LONG LONG SIGNED_KEYWORD INT_KEYWORD
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "long long"); }
 	|	LONG LONG SIGNED_KEYWORD
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "long long"); }
 	|	SIGNED_KEYWORD LONG LONG
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "long long"); }
 	|	SIGNED_KEYWORD LONG LONG INT_KEYWORD
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "long long"); }
 	|	UNSIGNED LONG LONG
 			{ $$ = lookup_unsigned_typename (pstate->language (),
-							 pstate->gdbarch (),
 							 "long long"); }
 	|	UNSIGNED LONG LONG INT_KEYWORD
 			{ $$ = lookup_unsigned_typename (pstate->language (),
-							 pstate->gdbarch (),
 							 "long long"); }
 	|	LONG LONG UNSIGNED
 			{ $$ = lookup_unsigned_typename (pstate->language (),
-							 pstate->gdbarch (),
 							 "long long"); }
 	|	LONG LONG UNSIGNED INT_KEYWORD
 			{ $$ = lookup_unsigned_typename (pstate->language (),
-							 pstate->gdbarch (),
 							 "long long"); }
 	|	SHORT INT_KEYWORD
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "short"); }
 	|	SHORT SIGNED_KEYWORD INT_KEYWORD
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "short"); }
 	|	SHORT SIGNED_KEYWORD
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "short"); }
 	|	UNSIGNED SHORT INT_KEYWORD
 			{ $$ = lookup_unsigned_typename (pstate->language (),
-							 pstate->gdbarch (),
 							 "short"); }
 	|	SHORT UNSIGNED
 			{ $$ = lookup_unsigned_typename (pstate->language (),
-							 pstate->gdbarch (),
 							 "short"); }
 	|	SHORT UNSIGNED INT_KEYWORD
 			{ $$ = lookup_unsigned_typename (pstate->language (),
-							 pstate->gdbarch (),
 							 "short"); }
 	|	DOUBLE_KEYWORD
 			{ $$ = lookup_typename (pstate->language (),
-						pstate->gdbarch (),
 						"double",
 						NULL,
 						0); }
 	|	LONG DOUBLE_KEYWORD
 			{ $$ = lookup_typename (pstate->language (),
-						pstate->gdbarch (),
 						"long double",
 						NULL,
 						0); }
@@ -1483,19 +1454,15 @@ typebase
 			}
 	|	UNSIGNED type_name
 			{ $$ = lookup_unsigned_typename (pstate->language (),
-							 pstate->gdbarch (),
 							 TYPE_NAME($2.type)); }
 	|	UNSIGNED
 			{ $$ = lookup_unsigned_typename (pstate->language (),
-							 pstate->gdbarch (),
 							 "int"); }
 	|	SIGNED_KEYWORD type_name
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       TYPE_NAME($2.type)); }
 	|	SIGNED_KEYWORD
 			{ $$ = lookup_signed_typename (pstate->language (),
-						       pstate->gdbarch (),
 						       "int"); }
                 /* It appears that this rule for templates is never
                    reduced; template recognition happens by lookahead
@@ -1517,7 +1484,6 @@ type_name:	TYPENAME
 		  $$.stoken.ptr = "int";
 		  $$.stoken.length = 3;
 		  $$.type = lookup_signed_typename (pstate->language (),
-						    pstate->gdbarch (),
 						    "int");
 		}
 	|	LONG
@@ -1525,7 +1491,6 @@ type_name:	TYPENAME
 		  $$.stoken.ptr = "long";
 		  $$.stoken.length = 4;
 		  $$.type = lookup_signed_typename (pstate->language (),
-						    pstate->gdbarch (),
 						    "long");
 		}
 	|	SHORT
@@ -1533,7 +1498,6 @@ type_name:	TYPENAME
 		  $$.stoken.ptr = "short";
 		  $$.stoken.length = 5;
 		  $$.type = lookup_signed_typename (pstate->language (),
-						    pstate->gdbarch (),
 						    "short");
 		}
 	;
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 1de44f7..846970a 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -611,16 +611,13 @@ evaluate_subexp_c (struct type *expect_type, struct expression *exp,
 					      exp->gdbarch);
 	    break;
 	  case C_WIDE_STRING:
-	    type = lookup_typename (exp->language_defn, exp->gdbarch,
-				    "wchar_t", NULL, 0);
+	    type = lookup_typename (exp->language_defn, "wchar_t", NULL, 0);
 	    break;
 	  case C_STRING_16:
-	    type = lookup_typename (exp->language_defn, exp->gdbarch,
-				    "char16_t", NULL, 0);
+	    type = lookup_typename (exp->language_defn, "char16_t", NULL, 0);
 	    break;
 	  case C_STRING_32:
-	    type = lookup_typename (exp->language_defn, exp->gdbarch,
-				    "char32_t", NULL, 0);
+	    type = lookup_typename (exp->language_defn, "char32_t", NULL, 0);
 	    break;
 	  default:
 	    internal_error (__FILE__, __LINE__, _("unhandled c_string_type"));
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 2b3f014..d813d05 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -547,7 +547,6 @@ cp_lookup_symbol_imports_or_template (const char *scope,
 	  struct type *context;
 	  std::string name_copy (function->natural_name ());
 	  const struct language_defn *lang = language_def (language_cplus);
-	  struct gdbarch *arch = symbol_arch (function);
 	  const struct block *parent = BLOCK_SUPERBLOCK (block);
 	  struct symbol *sym;
 
@@ -561,7 +560,7 @@ cp_lookup_symbol_imports_or_template (const char *scope,
 	      else
 		{
 		  name_copy.erase (prefix_len);
-		  context = lookup_typename (lang, arch,
+		  context = lookup_typename (lang,
 					     name_copy.c_str (),
 					     parent, 1);
 		}
diff --git a/gdb/eval.c b/gdb/eval.c
index 8787442..8c93c7a 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -562,20 +562,20 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch,
 	  break;
 	case language_opencl:
 	  if (result_len <= TYPE_LENGTH (lookup_signed_typename
-					 (language, gdbarch, "int")))
+					 (language, "int")))
 	    {
 	      promoted_type =
 		(unsigned_operation
-		 ? lookup_unsigned_typename (language, gdbarch, "int")
-		 : lookup_signed_typename (language, gdbarch, "int"));
+		 ? lookup_unsigned_typename (language, "int")
+		 : lookup_signed_typename (language, "int"));
 	    }
 	  else if (result_len <= TYPE_LENGTH (lookup_signed_typename
-					      (language, gdbarch, "long")))
+					      (language, "long")))
 	    {
 	      promoted_type =
 		(unsigned_operation
-		 ? lookup_unsigned_typename (language, gdbarch, "long")
-		 : lookup_signed_typename (language, gdbarch,"long"));
+		 ? lookup_unsigned_typename (language, "long")
+		 : lookup_signed_typename (language,"long"));
 	    }
 	  break;
 	default:
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 775e8c1..4854f49 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1555,7 +1555,7 @@ type_name_or_error (struct type *type)
 
 struct type *
 lookup_typename (const struct language_defn *language,
-		 struct gdbarch *gdbarch, const char *name,
+		 const char *name,
 		 const struct block *block, int noerr)
 {
   struct symbol *sym;
@@ -1572,29 +1572,28 @@ lookup_typename (const struct language_defn *language,
 
 struct type *
 lookup_unsigned_typename (const struct language_defn *language,
-			  struct gdbarch *gdbarch, const char *name)
+			  const char *name)
 {
   char *uns = (char *) alloca (strlen (name) + 10);
 
   strcpy (uns, "unsigned ");
   strcpy (uns + 9, name);
-  return lookup_typename (language, gdbarch, uns, NULL, 0);
+  return lookup_typename (language, uns, NULL, 0);
 }
 
 struct type *
-lookup_signed_typename (const struct language_defn *language,
-			struct gdbarch *gdbarch, const char *name)
+lookup_signed_typename (const struct language_defn *language, const char *name)
 {
   struct type *t;
   char *uns = (char *) alloca (strlen (name) + 8);
 
   strcpy (uns, "signed ");
   strcpy (uns + 7, name);
-  t = lookup_typename (language, gdbarch, uns, NULL, 1);
+  t = lookup_typename (language, uns, NULL, 1);
   /* If we don't find "signed FOO" just try again with plain "FOO".  */
   if (t != NULL)
     return t;
-  return lookup_typename (language, gdbarch, name, NULL, 0);
+  return lookup_typename (language, name, NULL, 0);
 }
 
 /* Lookup a structure type named "struct NAME",
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index e399f5f..0dd7333 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -2005,10 +2005,10 @@ extern struct type *lookup_string_range_type (struct type *, LONGEST, LONGEST);
 extern struct type *create_set_type (struct type *, struct type *);
 
 extern struct type *lookup_unsigned_typename (const struct language_defn *,
-					      struct gdbarch *, const char *);
+					      const char *);
 
 extern struct type *lookup_signed_typename (const struct language_defn *,
-					    struct gdbarch *, const char *);
+					    const char *);
 
 extern void get_unsigned_type_max (struct type *, ULONGEST *);
 
@@ -2048,8 +2048,7 @@ extern void check_stub_method_group (struct type *, int);
 extern char *gdb_mangle_name (struct type *, int, int);
 
 extern struct type *lookup_typename (const struct language_defn *,
-				     struct gdbarch *, const char *,
-				     const struct block *, int);
+				     const char *, const struct block *, int);
 
 extern struct type *lookup_template_type (const char *, struct type *,
 					  const struct block *);
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 953e17b..d5b289d 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -1245,7 +1245,7 @@ tyscm_lookup_typename (const char *type_name, const struct block *block)
       else if (startswith (type_name, "enum "))
 	type = lookup_enum (type_name + 5, NULL);
       else
-	type = lookup_typename (current_language, get_current_arch (),
+	type = lookup_typename (current_language,
 				type_name, block, 0);
     }
   catch (const gdb_exception &except)
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index 6a0173b..243f302 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -599,7 +599,6 @@ type
 	:	TYPENAME
 			{ $$
 			    = lookup_typename (pstate->language (),
-					       pstate->gdbarch (),
 					       copy_name ($1).c_str (),
 					       pstate->expression_context_block,
 					       0);
@@ -974,7 +973,7 @@ yylex (void)
 			 VAR_DOMAIN, 0).symbol;
     if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
       return BLOCKNAME;
-    if (lookup_typename (pstate->language (), pstate->gdbarch (),
+    if (lookup_typename (pstate->language (),
 			 tmp.c_str (), pstate->expression_context_block, 1))
       return TYPENAME;
 
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index fe0efd3..f7674cf 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -2326,7 +2326,7 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
   const gdb_byte *str;
   size_t len;
   struct gdbarch *gdbarch = get_type_arch (value_type (value));
-  struct type *wctype = lookup_typename (current_language, gdbarch,
+  struct type *wctype = lookup_typename (current_language,
 					 "wchar_t", NULL, 0);
   int wcwidth = TYPE_LENGTH (wctype);
 
@@ -2601,7 +2601,7 @@ ui_printf (const char *arg, struct ui_file *stream)
 	    {
 	      struct gdbarch *gdbarch
 		= get_type_arch (value_type (val_args[i]));
-	      struct type *wctype = lookup_typename (current_language, gdbarch,
+	      struct type *wctype = lookup_typename (current_language,
 						     "wchar_t", NULL, 0);
 	      struct type *valtype;
 	      const gdb_byte *bytes;
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index e435099..5a6c269 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -758,7 +758,7 @@ typy_lookup_typename (const char *type_name, const struct block *block)
       else if (startswith (type_name, "enum "))
 	type = lookup_enum (type_name + 5, NULL);
       else
-	type = lookup_typename (python_language, python_gdbarch,
+	type = lookup_typename (python_language,
 				type_name, block, 0);
     }
   catch (const gdb_exception &except)
diff --git a/gdb/python/py-xmethods.c b/gdb/python/py-xmethods.c
index 8606f40..650666e 100644
--- a/gdb/python/py-xmethods.c
+++ b/gdb/python/py-xmethods.c
@@ -580,7 +580,7 @@ python_xmethod_worker::invoke (struct value *obj,
     }
   else
     {
-      res = allocate_value (lookup_typename (python_language, python_gdbarch,
+      res = allocate_value (lookup_typename (python_language,
 					     "void", NULL, 0));
     }
 
diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y
index a15e0de..5587ebf 100644
--- a/gdb/rust-exp.y
+++ b/gdb/rust-exp.y
@@ -2024,7 +2024,7 @@ rust_parser::rust_lookup_type (const char *name, const struct block *block)
       return SYMBOL_TYPE (result.symbol);
     }
 
-  type = lookup_typename (language (), arch (), name, NULL, 1);
+  type = lookup_typename (language (), name, NULL, 1);
   if (type != NULL)
     return type;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-05 20:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-05 20:04 [binutils-gdb] Remove gdbarch parameter of lookup_typename Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).