[RFC] Remove unnecessary argument METHOD to valops.c:oload_method_static

Siva Chandra sivachandra@google.com
Mon Mar 3 13:28:00 GMT 2014


The attached patch removes the unnecessary argument METHOD to
oload_method_static in valops.c

Doug had said (https://sourceware.org/ml/gdb-patches/2014-02/msg00889.html)
that it could be renamed to "oload_method_static_offset", but I am not
very sure we should change it to offset for this.  The return value is
used as an offset as in an offset of 1 or 0 to adjust for the 'this'
pointer if the method in question is static.  But, it does not produce
any other offset other than that.  Would "oload_method_static_p" be
better?

ChangeLog

        * valops.c (oload_method_static): Remove unnecessary argument
        METHOD.
        (find_overload_match): Update call to oload_method_static.
        (find_oload_champ): Likewise.
-------------- next part --------------
diff --git a/gdb/valops.c b/gdb/valops.c
index cf195a3..1e92403 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -73,7 +73,7 @@ static int find_oload_champ (struct value **, int, int,
 			     struct fn_field *, struct symbol **,
 			     struct badness_vector **);
 
-static int oload_method_static (int, struct fn_field *, int);
+static int oload_method_static (struct fn_field *, int);
 
 enum oload_classification { STANDARD, NON_STANDARD, INCOMPATIBLE };
 
@@ -2475,7 +2475,7 @@ find_overload_match (struct value **args, int nargs,
 
 	  method_match_quality =
 	      classify_oload_match (method_badness, nargs,
-	                            oload_method_static (method, fns_ptr,
+	                            oload_method_static (fns_ptr,
 	                                                 method_oload_champ));
 
 	  make_cleanup (xfree, method_badness);
@@ -2624,7 +2624,7 @@ find_overload_match (struct value **args, int nargs,
     }
 
   if (staticp != NULL)
-    *staticp = oload_method_static (method, fns_ptr, method_oload_champ);
+    *staticp = oload_method_static (fns_ptr, method_oload_champ);
 
   if (method_oload_champ >= 0)
     {
@@ -2863,7 +2863,7 @@ find_oload_champ (struct value **args, int nargs,
       if (fns_ptr != NULL)
 	{
 	  nparms = TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (fns_ptr, ix));
-	  static_offset = oload_method_static (1, fns_ptr, ix);
+	  static_offset = oload_method_static (fns_ptr, ix);
 	}
       else
 	{
@@ -2941,10 +2941,9 @@ find_oload_champ (struct value **args, int nargs,
    a non-static method or a function that isn't a method.  */
 
 static int
-oload_method_static (int method, struct fn_field *fns_ptr, int index)
+oload_method_static (struct fn_field *fns_ptr, int index)
 {
-  if (method && fns_ptr && index >= 0
-      && TYPE_FN_FIELD_STATIC_P (fns_ptr, index))
+  if (fns_ptr && index >= 0 && TYPE_FN_FIELD_STATIC_P (fns_ptr, index))
     return 1;
   else
     return 0;


More information about the Gdb-patches mailing list