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.
This commit is contained in:
Simon Marchi 2019-12-05 13:44:30 -05:00 committed by Simon Marchi
parent a23e9ba17f
commit b858499daf
13 changed files with 51 additions and 69 deletions

View File

@ -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

View File

@ -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");
}
;

View File

@ -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"));

View File

@ -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);
}

View File

@ -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:

View File

@ -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",

View File

@ -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 *);

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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));
}

View File

@ -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;