[PATCH 03/18] poison "this"

Ondrej Oprala
2013-10-09T17:17:58Z

From: Tom Tromey <tromey@redhat.com>

bfd/
* libbfd-in.h (item) : Renamed from this. Update copyright year.
* libbfd.h (item) : Renamed from this. Update copyright year.

gdb/
* addrmap.c (self) : Renamed from this.
* cp-namespace.c (this_sym) : Likewise.
* frame.c (self) : Likewise.
* gdbarch.c (self) : Likewise.
* gdbarch.sh (self) : Likewise.
---
bfd/ChangeLog | 5 +++++
bfd/libbfd-in.h | 8 ++++----
bfd/libbfd.h | 8 ++++----
gdb/ChangeLog | 13 +++++++++++--
gdb/addrmap.c | 50 +++++++++++++++++++++++++-------------------------
gdb/cp-namespace.c | 9 +++++----
gdb/frame.c | 8 ++++----
gdb/gdbarch.c | 22 +++++++++++-----------
gdb/gdbarch.sh | 22 +++++++++++-----------
9 files changed, 80 insertions(+), 65 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 6162114..0c1a326 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -15,6 +15,11 @@

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

+ * libbfd-in.h (item) : Renamed from this. Update copyright year.
+ * libbfd.h (item) : Renamed from this. Update copyright year.
+
+2013-10-09 Tom Tromey <tromey@redhat.com>
+
* bfd-in2.h: Rebuild.
* opncls.c (bfd_get_alt_debug_link_info): Change type of
buildid_len to bfd_size_type.
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index 52c1f5f..b991d1b 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -3,7 +3,7 @@

Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
- 2010, 2011, 2012
+ 2010, 2011, 2012, 2013
Free Software Foundation, Inc.

Written by Cygnus Support.
@@ -31,9 +31,9 @@
E.g. align to an 8-byte boundary with argument of 8. Take care never
to wrap around if the address is within boundary-1 of the end of the
address space. */
-#define BFD_ALIGN(this, boundary) \
- ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \
- ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
+#define BFD_ALIGN(item, boundary) \
+ ((((bfd_vma) (item) + (boundary) - 1) >= (bfd_vma) (item)) \
+ ? (((bfd_vma) (item) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
: ~ (bfd_vma) 0)

/* If you want to read and write large blocks, you might want to do it
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 1381803..487b10a 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -8,7 +8,7 @@

Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
- 2010, 2011, 2012
+ 2010, 2011, 2012, 2013
Free Software Foundation, Inc.

Written by Cygnus Support.
@@ -36,9 +36,9 @@
E.g. align to an 8-byte boundary with argument of 8. Take care never
to wrap around if the address is within boundary-1 of the end of the
address space. */
-#define BFD_ALIGN(this, boundary) \
- ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \
- ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
+#define BFD_ALIGN(item, boundary) \
+ ((((bfd_vma) (item) + (boundary) - 1) >= (bfd_vma) (item)) \
+ ? (((bfd_vma) (item) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
: ~ (bfd_vma) 0)

/* If you want to read and write large blocks, you might want to do it
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8cb2a86..be3cf66 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -17,8 +17,11 @@

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

- * dwarf2read.c (dwarf2_get_dwz_file): Update for type change in
- bfd_get_alt_debug_link_info.
+ * addrmap.c (self) : Renamed from this.
+ * cp-namespace.c (this_sym) : Likewise.
+ * frame.c (self) : Likewise.
+ * gdbarch.c (self) : Likewise.
+ * gdbarch.sh (self) : Likewise.

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

@@ -74,6 +77,12 @@
* python/py-symbol.c(klass) : Likewise.
* top.c(klass) : Likewise.

+2013-10-09 Tom Tromey <tromey@redhat.com>
+
+ * dwarf2read.c (dwarf2_get_dwz_file): Update for type change in
+ bfd_get_alt_debug_link_info.
+
+
2013-10-09 Jan Kratochvil <jan.kratochvil@redhat.com>

New flag OBJF_NOT_FILENAME.
diff --git a/gdb/addrmap.c b/gdb/addrmap.c
index 22694ed..348fd43 100644
--- a/gdb/addrmap.c
+++ b/gdb/addrmap.c
@@ -34,14 +34,14 @@
implementation. */
struct addrmap_funcs
{
- void (*set_empty) (struct addrmap *this,
+ void (*set_empty) (struct addrmap *self,
CORE_ADDR start, CORE_ADDR end_inclusive,
void *obj);
- void *(*find) (struct addrmap *this, CORE_ADDR addr);
- struct addrmap *(*create_fixed) (struct addrmap *this,
+ void *(*find) (struct addrmap *self, CORE_ADDR addr);
+ struct addrmap *(*create_fixed) (struct addrmap *self,
struct obstack *obstack);
- void (*relocate) (struct addrmap *this, CORE_ADDR offset);
- int (*foreach) (struct addrmap *this, addrmap_foreach_fn fn, void *data);
+ void (*relocate) (struct addrmap *self, CORE_ADDR offset);
+ int (*foreach) (struct addrmap *self, addrmap_foreach_fn fn, void *data);
};

@@ -118,7 +118,7 @@ struct addrmap_fixed

static void
-addrmap_fixed_set_empty (struct addrmap *this,
+addrmap_fixed_set_empty (struct addrmap *self,
CORE_ADDR start, CORE_ADDR end_inclusive,
void *obj)
{
@@ -129,9 +129,9 @@ addrmap_fixed_set_empty (struct addrmap *this,

static void *
-addrmap_fixed_find (struct addrmap *this, CORE_ADDR addr)
+addrmap_fixed_find (struct addrmap *self, CORE_ADDR addr)
{
- struct addrmap_fixed *map = (struct addrmap_fixed *) this;
+ struct addrmap_fixed *map = (struct addrmap_fixed *) self;
struct addrmap_transition *bottom = &map->transitions[0];
struct addrmap_transition *top = &map->transitions[map->num_transitions - 1];

@@ -162,7 +162,7 @@ addrmap_fixed_find (struct addrmap *this, CORE_ADDR addr)

static struct addrmap *
-addrmap_fixed_create_fixed (struct addrmap *this, struct obstack *obstack)
+addrmap_fixed_create_fixed (struct addrmap *self, struct obstack *obstack)
{
internal_error (__FILE__, __LINE__,
_("addrmap_create_fixed is not implemented yet "
@@ -171,9 +171,9 @@ addrmap_fixed_create_fixed (struct addrmap *this, struct obstack *obstack)

static void
-addrmap_fixed_relocate (struct addrmap *this, CORE_ADDR offset)
+addrmap_fixed_relocate (struct addrmap *self, CORE_ADDR offset)
{
- struct addrmap_fixed *map = (struct addrmap_fixed *) this;
+ struct addrmap_fixed *map = (struct addrmap_fixed *) self;
size_t i;

for (i = 0; i < map->num_transitions; i++)
@@ -182,10 +182,10 @@ addrmap_fixed_relocate (struct addrmap *this, CORE_ADDR offset)

static int
-addrmap_fixed_foreach (struct addrmap *this, addrmap_foreach_fn fn,
+addrmap_fixed_foreach (struct addrmap *self, addrmap_foreach_fn fn,
void *data)
{
- struct addrmap_fixed *map = (struct addrmap_fixed *) this;
+ struct addrmap_fixed *map = (struct addrmap_fixed *) self;
size_t i;

for (i = 0; i < map->num_transitions; i++)
@@ -320,26 +320,26 @@ addrmap_splay_tree_insert (struct addrmap_mutable *map,
tree node at ADDR, even if it would represent a "transition" from
one value to the same value. */
static void
-force_transition (struct addrmap_mutable *this, CORE_ADDR addr)
+force_transition (struct addrmap_mutable *self, CORE_ADDR addr)
{
splay_tree_node n
- = addrmap_splay_tree_lookup (this, addr);
+ = addrmap_splay_tree_lookup (self, addr);

if (! n)
{
- n = addrmap_splay_tree_predecessor (this, addr);
- addrmap_splay_tree_insert (this, addr,
+ n = addrmap_splay_tree_predecessor (self, addr);
+ addrmap_splay_tree_insert (self, addr,
n ? addrmap_node_value (n) : NULL);
}
}

static void
-addrmap_mutable_set_empty (struct addrmap *this,
+addrmap_mutable_set_empty (struct addrmap *self,
CORE_ADDR start, CORE_ADDR end_inclusive,
void *obj)
{
- struct addrmap_mutable *map = (struct addrmap_mutable *) this;
+ struct addrmap_mutable *map = (struct addrmap_mutable *) self;
splay_tree_node n, next;
void *prior_value;

@@ -389,7 +389,7 @@ addrmap_mutable_set_empty (struct addrmap *this,

static void *
-addrmap_mutable_find (struct addrmap *this, CORE_ADDR addr)
+addrmap_mutable_find (struct addrmap *self, CORE_ADDR addr)
{
/* Not needed yet. */
internal_error (__FILE__, __LINE__,
@@ -427,9 +427,9 @@ splay_foreach_copy (splay_tree_node n, void *closure)

static struct addrmap *
-addrmap_mutable_create_fixed (struct addrmap *this, struct obstack *obstack)
+addrmap_mutable_create_fixed (struct addrmap *self, struct obstack *obstack)
{
- struct addrmap_mutable *mutable = (struct addrmap_mutable *) this;
+ struct addrmap_mutable *mutable = (struct addrmap_mutable *) self;
struct addrmap_fixed *fixed;
size_t num_transitions;

@@ -462,7 +462,7 @@ addrmap_mutable_create_fixed (struct addrmap *this, struct obstack *obstack)

static void
-addrmap_mutable_relocate (struct addrmap *this, CORE_ADDR offset)
+addrmap_mutable_relocate (struct addrmap *self, CORE_ADDR offset)
{
/* Not needed yet. */
internal_error (__FILE__, __LINE__,
@@ -493,10 +493,10 @@ addrmap_mutable_foreach_worker (splay_tree_node node, void *data)

static int
-addrmap_mutable_foreach (struct addrmap *this, addrmap_foreach_fn fn,
+addrmap_mutable_foreach (struct addrmap *self, addrmap_foreach_fn fn,
void *data)
{
- struct addrmap_mutable *mutable = (struct addrmap_mutable *) this;
+ struct addrmap_mutable *mutable = (struct addrmap_mutable *) self;
struct mutable_foreach_data foreach_data;

foreach_data.fn = fn;
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index f7db48c..bc5ea10 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -660,16 +660,17 @@ lookup_symbol_file (const char *name,
if (prefix_len == 0)
{
struct type *type;
- struct symbol *this;
+ struct symbol *this_sym;

- this = lookup_language_this (language_def (language_cplus), block);
- if (this == NULL)
+ this_sym = lookup_language_this (language_def (language_cplus),
+ block);
+ if (this_sym == NULL)
{
do_cleanups (cleanup);
return NULL;
}

- type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (this)));
+ type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (this_sym)));
klass = xstrdup (TYPE_NAME (type));
nested = xstrdup (name);
}
diff --git a/gdb/frame.c b/gdb/frame.c
index 59e31db..fd56c84 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -667,9 +667,9 @@ frame_find_by_id (struct frame_id id)

for (frame = get_current_frame (); ; frame = prev_frame)
{
- struct frame_id this = get_frame_id (frame);
+ struct frame_id self = get_frame_id (frame);

- if (frame_id_eq (id, this))
+ if (frame_id_eq (id, self))
/* An exact match. */
return frame;

@@ -683,7 +683,7 @@ frame_find_by_id (struct frame_id id)
frame in the current frame chain can have this ID. See the
comment at frame_id_inner for details. */
if (get_frame_type (frame) == NORMAL_FRAME
- && !frame_id_inner (get_frame_arch (frame), id, this)
+ && !frame_id_inner (get_frame_arch (frame), id, self)
&& frame_id_inner (get_frame_arch (prev_frame), id,
get_frame_id (prev_frame)))
return NULL;
@@ -704,7 +704,7 @@ frame_unwind_pc_if_available (struct frame_info *this_frame, CORE_ADDR *pc)

/* The right way. The `pure' way. The one true way. This
method depends solely on the register-unwind code to
- determine the value of registers in THIS frame, and hence
+ determine the value of registers in SELF frame, and hence
the value of this frame's PC (resume address). A typical
implementation is no more than:

diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 1f3380e..396bb67 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -4744,7 +4744,7 @@ gdbarch_find_by_info (struct gdbarch_info info)
if (new_gdbarch->initialized_p)
{
struct gdbarch_list **list;
- struct gdbarch_list *this;
+ struct gdbarch_list *self;
if (gdbarch_debug)
fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
"Previous architecture %s (%s) selected\n",
@@ -4756,12 +4756,12 @@ gdbarch_find_by_info (struct gdbarch_info info)
list = &(*list)->next);
/* It had better be in the list of architectures. */
gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch);
- /* Unlink THIS. */
- this = (*list);
- (*list) = this->next;
- /* Insert THIS at the front. */
- this->next = rego->arches;
- rego->arches = this;
+ /* Unlink SELF. */
+ self = (*list);
+ (*list) = self->next;
+ /* Insert SELF at the front. */
+ self->next = rego->arches;
+ rego->arches = self;
/* Return it. */
return new_gdbarch;
}
@@ -4776,10 +4776,10 @@ gdbarch_find_by_info (struct gdbarch_info info)
/* Insert the new architecture into the front of the architecture
list (keep the list sorted Most Recently Used). */
{
- struct gdbarch_list *this = XMALLOC (struct gdbarch_list);
- this->next = rego->arches;
- this->gdbarch = new_gdbarch;
- rego->arches = this;
+ struct gdbarch_list *self = XMALLOC (struct gdbarch_list);
+ self->next = rego->arches;
+ self->gdbarch = new_gdbarch;
+ rego->arches = self;
}

/* Check that the newly installed architecture is valid. Plug in
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 5e46788..e24b6b5 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -2248,7 +2248,7 @@ gdbarch_find_by_info (struct gdbarch_info info)
if (new_gdbarch->initialized_p)
{
struct gdbarch_list **list;
- struct gdbarch_list *this;
+ struct gdbarch_list *self;
if (gdbarch_debug)
fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
"Previous architecture %s (%s) selected\n",
@@ -2260,12 +2260,12 @@ gdbarch_find_by_info (struct gdbarch_info info)
list = &(*list)->next);
/* It had better be in the list of architectures. */
gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch);
- /* Unlink THIS. */
- this = (*list);
- (*list) = this->next;
- /* Insert THIS at the front. */
- this->next = rego->arches;
- rego->arches = this;
+ /* Unlink SELF. */
+ self = (*list);
+ (*list) = self->next;
+ /* Insert SELF at the front. */
+ self->next = rego->arches;
+ rego->arches = self;
/* Return it. */
return new_gdbarch;
}
@@ -2280,10 +2280,10 @@ gdbarch_find_by_info (struct gdbarch_info info)
/* Insert the new architecture into the front of the architecture
list (keep the list sorted Most Recently Used). */
{
- struct gdbarch_list *this = XMALLOC (struct gdbarch_list);
- this->next = rego->arches;
- this->gdbarch = new_gdbarch;
- rego->arches = this;
+ struct gdbarch_list *self = XMALLOC (struct gdbarch_list);
+ self->next = rego->arches;
+ self->gdbarch = new_gdbarch;
+ rego->arches = self;
}

/* Check that the newly installed architecture is valid. Plug in
--
1.8.3.1