This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] ada-lang.c: Rename function base_type into get_base_type


Hello,

I've just checked in the following patch.

This avoids shadowing issues with variables named base_type.

Rather than change the name of all the variables called base_type,
I prefer to change the name of the function itself, to get_base_type.
I'm not super fond of this name relative to another function called
ada_get_base_type (and is quite different), but I couldn't think of
a better name for now.

gdb/ChangeLog:

        * ada-lang.c (get_base_type): Renames base_type.  Adjust all
        calls throughout this file.

Tested on x86_64-linux.

---
 gdb/ChangeLog  |    5 +++++
 gdb/ada-lang.c |   14 +++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e16f120..3bb6d51 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2011-11-23  Joel Brobecker  <brobecker@adacore.com>
 
+	* ada-lang.c (get_base_type): Renames base_type.  Adjust all
+	calls throughout this file.
+
+2011-11-23  Joel Brobecker  <brobecker@adacore.com>
+
 	* gdb-dlfcn.c (gdb_dlopen): Add missing coma in call to
 	FormatMessage.
 
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 2edbe7f..6676685 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -716,7 +716,7 @@ ada_discrete_type_low_bound (struct type *type)
    non-range scalar type.  */
 
 static struct type *
-base_type (struct type *type)
+get_base_type (struct type *type)
 {
   while (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE)
     {
@@ -3325,13 +3325,13 @@ return_match (struct type *func_type, struct type *context_type)
     return 1;
 
   if (TYPE_CODE (func_type) == TYPE_CODE_FUNC)
-    return_type = base_type (TYPE_TARGET_TYPE (func_type));
+    return_type = get_base_type (TYPE_TARGET_TYPE (func_type));
   else
-    return_type = base_type (func_type);
+    return_type = get_base_type (func_type);
   if (return_type == NULL)
     return 1;
 
-  context_type = base_type (context_type);
+  context_type = get_base_type (context_type);
 
   if (TYPE_CODE (return_type) == TYPE_CODE_ENUM)
     return context_type == NULL || return_type == context_type;
@@ -8500,8 +8500,8 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
 
   arg1 = coerce_ref (arg1);
   arg2 = coerce_ref (arg2);
-  type1 = base_type (ada_check_typedef (value_type (arg1)));
-  type2 = base_type (ada_check_typedef (value_type (arg2)));
+  type1 = get_base_type (ada_check_typedef (value_type (arg1)));
+  type2 = get_base_type (ada_check_typedef (value_type (arg2)));
 
   if (TYPE_CODE (type1) != TYPE_CODE_INT
       || TYPE_CODE (type2) != TYPE_CODE_INT)
@@ -10453,7 +10453,7 @@ ada_is_range_type_name (const char *name)
 int
 ada_is_modular_type (struct type *type)
 {
-  struct type *subranged_type = base_type (type);
+  struct type *subranged_type = get_base_type (type);
 
   return (subranged_type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE
           && TYPE_CODE (subranged_type) == TYPE_CODE_INT
-- 
1.7.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]