[PATCH 13/18] poison "typename"

Ondrej Oprala
2013-10-09T17:18:07Z

From: Tom Tromey <tromey@redhat.com>

* ada-lang.c (type_name) : Renamed from typename.
* break-catch-throw.c (type_name) : Likewise.
* cp-valprint.c (type_name) : Likewise.
* dwarf2read.c (type_name) : Likewise.
* gdbtypes.c (type_name) : Likewise.
* gnu-v3-abi.c (type_name) : Likewise.
* p-valprint.c (type_name) : Likewise.
* stabsread.c (type_name) : Likewise.
* typeprint.c (type_name) : Likewise.
---
gdb/ChangeLog | 12 ++++++++++++
gdb/ada-lang.c | 8 ++++----
gdb/break-catch-throw.c | 14 +++++++-------
gdb/cp-valprint.c | 4 ++--
gdb/dwarf2read.c | 10 +++++-----
gdb/gdbtypes.c | 20 ++++++++++----------
gdb/gnu-v3-abi.c | 26 +++++++++++++-------------
gdb/p-valprint.c | 6 +++---
gdb/stabsread.c | 6 +++---
gdb/typeprint.c | 12 ++++++------
10 files changed, 65 insertions(+), 53 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 03d8538..43e9cc5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -17,6 +17,18 @@

2013-10-09 Tom Tromey <tromey@redhat.com>

+ * ada-lang.c (type_name) : Renamed from typename.
+ * break-catch-throw.c (type_name) : Likewise.
+ * cp-valprint.c (type_name) : Likewise.
+ * dwarf2read.c (type_name) : Likewise.
+ * gdbtypes.c (type_name) : Likewise.
+ * gnu-v3-abi.c (type_name) : Likewise.
+ * p-valprint.c (type_name) : Likewise.
+ * stabsread.c (type_name) : Likewise.
+ * typeprint.c (type_name) : Likewise.
+
+2013-10-09 Tom Tromey <tromey@redhat.com>
+
* hppa-linux-tdep.c (attempt) : Renamed from try.
* i386-nat.c (attempt) : Likewise.
* remote-mips.c (attempt) : Likewise.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 1150fd6..515164f 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -7480,17 +7480,17 @@ struct type *
ada_find_parallel_type (struct type *type, const char *suffix)
{
char *name;
- const char *typename = ada_type_name (type);
+ const char *type_name = ada_type_name (type);
int len;

- if (typename == NULL)
+ if (type_name == NULL)
return NULL;

- len = strlen (typename);
+ len = strlen (type_name);

name = (char *) alloca (len + strlen (suffix) + 1);

- strcpy (name, typename);
+ strcpy (name, type_name);
strcpy (name + len, suffix);

return ada_find_parallel_type_with_name (type, name);
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index fb24725..afeca1e 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -168,7 +168,7 @@ check_status_exception_catchpoint (struct bpstats *bs)
{
struct exception_catchpoint *self
= (struct exception_catchpoint *) bs->breakpoint_at;
- char *typename = NULL;
+ char *type_name = NULL;
volatile struct gdb_exception e;

bkpt_breakpoint_ops.check_status (bs);
@@ -184,22 +184,22 @@ check_status_exception_catchpoint (struct bpstats *bs)
char *canon;

fetch_probe_arguments (NULL, &typeinfo_arg);
- typename = cplus_typename_from_type_info (typeinfo_arg);
+ type_name = cplus_typename_from_type_info (typeinfo_arg);

- canon = cp_canonicalize_string (typename);
+ canon = cp_canonicalize_string (type_name);
if (canon != NULL)
{
- xfree (typename);
- typename = canon;
+ xfree (type_name);
+ type_name = canon;
}
}

if (e.reason < 0)
exception_print (gdb_stderr, e);
- else if (regexec (self->pattern, typename, 0, NULL, 0) != 0)
+ else if (regexec (self->pattern, type_name, 0, NULL, 0) != 0)
bs->stop = 0;

- xfree (typename);
+ xfree (type_name);
}

/* Implement the 're_set' method. */
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 1d7147c..8734bb7 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -98,9 +98,9 @@ const char vtbl_ptr_name[] = "__vtbl_ptr_type";
int
cp_is_vtbl_ptr_type (struct type *type)
{
- const char *typename = type_name_no_tag (type);
+ const char *type_name = type_name_no_tag (type);

- return (typename != NULL && !strcmp (typename, vtbl_ptr_name));
+ return (type_name != NULL && !strcmp (type_name, vtbl_ptr_name));
}

/* Return truth value for the assertion that TYPE is of the type
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 0fb607c..d4d4866 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -12263,7 +12263,7 @@ static int
dwarf2_is_constructor (struct die_info *die, struct dwarf2_cu *cu)
{
const char *fieldname;
- const char *typename;
+ const char *type_name;
int len;

if (die->parent == NULL)
@@ -12275,13 +12275,13 @@ dwarf2_is_constructor (struct die_info *die, struct dwarf2_cu *cu)
return 0;

fieldname = dwarf2_name (die, cu);
- typename = dwarf2_name (die->parent, cu);
- if (fieldname == NULL || typename == NULL)
+ type_name = dwarf2_name (die->parent, cu);
+ if (fieldname == NULL || type_name == NULL)
return 0;

len = strlen (fieldname);
- return (strncmp (fieldname, typename, len) == 0
- && (typename[len] == '\0' || typename[len] == '<'));
+ return (strncmp (fieldname, type_name, len) == 0
+ && (type_name[len] == '\0' || type_name[len] == '<'));
}

/* Add a member function to the proper fieldlist. */
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 592e142..4ab47ec 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1356,7 +1356,7 @@ struct type *
lookup_struct_elt_type (struct type *type, const char *name, int noerr)
{
int i;
- char *typename;
+ char *type_name;

for (;;)
{
@@ -1370,9 +1370,9 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
if (TYPE_CODE (type) != TYPE_CODE_STRUCT
&& TYPE_CODE (type) != TYPE_CODE_UNION)
{
- typename = type_to_string (type);
- make_cleanup (xfree, typename);
- error (_("Type %s is not a structure or union type."), typename);
+ type_name = type_to_string (type);
+ make_cleanup (xfree, type_name);
+ error (_("Type %s is not a structure or union type."), type_name);
}

#if 0
@@ -1381,10 +1381,10 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
I.e. when doing "ptype bell->bar" for "struct foo { int bar; int
foo; } bell;" Disabled by fnf. */
{
- char *typename;
+ char *type_name;

- typename = type_name_no_tag (type);
- if (typename != NULL && strcmp (typename, name) == 0)
+ type_name = type_name_no_tag (type);
+ if (type_name != NULL && strcmp (type_name, name) == 0)
return type;
}
#endif
@@ -1424,9 +1424,9 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
return NULL;
}

- typename = type_to_string (type);
- make_cleanup (xfree, typename);
- error (_("Type %s has no component named %s."), typename, name);
+ type_name = type_to_string (type);
+ make_cleanup (xfree, type_name);
+ error (_("Type %s has no component named %s."), type_name, name);
}

/* Lookup the vptr basetype/fieldno values for TYPE.
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 1821f18..4bc7645 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -1066,7 +1066,7 @@ gnuv3_get_typeid (struct value *value)
struct gdbarch *gdbarch;
struct cleanup *cleanup;
struct value *result;
- char *typename, *canonical;
+ char *type_name, *canonical;

/* We have to handle values a bit trickily here, to allow this code
to work properly with non_lvalue values that are really just
@@ -1085,20 +1085,20 @@ gnuv3_get_typeid (struct value *value)
type = make_cv_type (0, 0, type, NULL);
gdbarch = get_type_arch (type);

- typename = type_to_string (type);
- if (typename == NULL)
+ type_name = type_to_string (type);
+ if (type_name == NULL)
error (_("cannot find typeinfo for unnamed type"));
- cleanup = make_cleanup (xfree, typename);
+ cleanup = make_cleanup (xfree, type_name);

/* We need to canonicalize the type name here, because we do lookups
using the demangled name, and so we must match the format it
uses. E.g., GDB tends to use "const char *" as a type name, but
the demangler uses "char const *". */
- canonical = cp_canonicalize_string (typename);
+ canonical = cp_canonicalize_string (type_name);
if (canonical != NULL)
{
make_cleanup (xfree, canonical);
- typename = canonical;
+ type_name = canonical;
}

typeinfo_type = gnuv3_get_typeid_type (gdbarch);
@@ -1114,7 +1114,7 @@ gnuv3_get_typeid (struct value *value)

vtable = gnuv3_get_vtable (gdbarch, type, address);
if (vtable == NULL)
- error (_("cannot find typeinfo for object of type '%s'"), typename);
+ error (_("cannot find typeinfo for object of type '%s'"), type_name);
typeinfo_value = value_field (vtable, vtable_field_type_info);
result = value_ind (value_cast (make_pointer_type (typeinfo_type, NULL),
typeinfo_value));
@@ -1124,12 +1124,12 @@ gnuv3_get_typeid (struct value *value)
char *sym_name;
struct minimal_symbol *minsym;

- sym_name = concat ("typeinfo for ", typename, (char *) NULL);
+ sym_name = concat ("typeinfo for ", type_name, (char *) NULL);
make_cleanup (xfree, sym_name);
minsym = lookup_minimal_symbol (sym_name, NULL, NULL);

if (minsym == NULL)
- error (_("could not find typeinfo symbol for '%s'"), typename);
+ error (_("could not find typeinfo symbol for '%s'"), type_name);

result = value_at_lazy (typeinfo_type, SYMBOL_VALUE_ADDRESS (minsym));
}
@@ -1177,21 +1177,21 @@ gnuv3_get_typename_from_type_info (struct value *type_info_ptr)
static struct type *
gnuv3_get_type_from_type_info (struct value *type_info_ptr)
{
- char *typename;
+ char *type_name;
struct cleanup *cleanup;
struct value *type_val;
struct expression *expr;
struct type *result;

- typename = gnuv3_get_typename_from_type_info (type_info_ptr);
- cleanup = make_cleanup (xfree, typename);
+ type_name = gnuv3_get_typename_from_type_info (type_info_ptr);
+ cleanup = make_cleanup (xfree, type_name);

/* We have to parse the type name, since in general there is not a
symbol for a type. This is somewhat bogus since there may be a
mis-parse. Another approach might be to re-use the demangler's
internal form to reconstruct the type somehow. */

- expr = parse_expression (typename);
+ expr = parse_expression (type_name);
make_cleanup (xfree, expr);

type_val = evaluate_type (expr);
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index e6d4b91..e71b0c0 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -483,10 +483,10 @@ const char pascal_vtbl_ptr_name[] =
int
pascal_object_is_vtbl_ptr_type (struct type *type)
{
- const char *typename = type_name_no_tag (type);
+ const char *type_name = type_name_no_tag (type);

- return (typename != NULL
- && strcmp (typename, pascal_vtbl_ptr_name) == 0);
+ return (type_name != NULL
+ && strcmp (type_name, pascal_vtbl_ptr_name) == 0);
}

/* Return truth value for the assertion that TYPE is of the type
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index b6c78be..93f23b1 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -4548,9 +4548,9 @@ cleanup_undefined_types_1 (void)
struct pending *ppt;
int i;
/* Name of the type, without "struct" or "union". */
- const char *typename = TYPE_TAG_NAME (*type);
+ const char *type_name = TYPE_TAG_NAME (*type);

- if (typename == NULL)
+ if (type_name == NULL)
{
complaint (&symfile_complaints, _("need a type name"));
break;
@@ -4568,7 +4568,7 @@ cleanup_undefined_types_1 (void)
&& (TYPE_INSTANCE_FLAGS (*type) ==
TYPE_INSTANCE_FLAGS (SYMBOL_TYPE (sym)))
&& strcmp (SYMBOL_LINKAGE_NAME (sym),
- typename) == 0)
+ type_name) == 0)
replace_type (*type, SYMBOL_TYPE (sym));
}
}
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 36b2f47..3569ad0 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -500,12 +500,12 @@ whatis_command (char *exp, int from_tty)
whatis_exp (exp, -1);
}

-/* TYPENAME is either the name of a type, or an expression. */
+/* TYPE_NAME is either the name of a type, or an expression. */

static void
-ptype_command (char *typename, int from_tty)
+ptype_command (char *type_name, int from_tty)
{
- whatis_exp (typename, 1);
+ whatis_exp (type_name, 1);
}

/* Print integral scalar data VAL, of type TYPE, onto stdio stream STREAM.
@@ -596,16 +596,16 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
and whatis_command(). */

void
-maintenance_print_type (char *typename, int from_tty)
+maintenance_print_type (char *type_name, int from_tty)
{
struct value *val;
struct type *type;
struct cleanup *old_chain;
struct expression *expr;

- if (typename != NULL)
+ if (type_name != NULL)
{
- expr = parse_expression (typename);
+ expr = parse_expression (type_name);
old_chain = make_cleanup (free_current_contents, &expr);
if (expr->elts[0].opcode == OP_TYPE)
{
--
1.8.3.1