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]

Re: [rfa] function parameter shadowed by local variable in opencl-lang.c


Joel Brobecker wrote:
> > >Probably this wasn't intentional?
> > >
> > 
> > Oops, another instance of the same thing:
> 
> I wish the compiler would warn us about things like this...  The patch
> looks correct to me, but I will let Ken and Ulrich take a look. Perhaps
> they'll be able to suggest a more specific name than `length2' ;-).

I guess I'd go with something along these lines ...

Bye,
Ulrich


Index: gdb/opencl-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/opencl-lang.c,v
retrieving revision 1.7
diff -u -p -r1.7 opencl-lang.c
--- gdb/opencl-lang.c	21 Feb 2011 15:53:10 -0000	1.7
+++ gdb/opencl-lang.c	28 Feb 2011 15:14:56 -0000
@@ -263,11 +263,11 @@ lval_func_check_validity (const struct v
 
   for (i = start; i < end; i++)
     {
-      int startoffset = (i == start) ? startrest : 0;
-      int length = (i == end) ? endrest : elsize;
+      int comp_offset = (i == start) ? startrest : 0;
+      int comp_length = (i == end) ? endrest : elsize;
 
-      if (!value_bits_valid (c->val, c->indices[i] * elsize + startoffset,
-			     length))
+      if (!value_bits_valid (c->val, c->indices[i] * elsize + comp_offset,
+			     comp_length))
 	return 0;
     }
 
@@ -317,12 +317,12 @@ lval_func_check_synthetic_pointer (const
 
   for (i = start; i < end; i++)
     {
-      int startoffset = (i == start) ? startrest : 0;
-      int length = (i == end) ? endrest : elsize;
+      int comp_offset = (i == start) ? startrest : 0;
+      int comp_length = (i == end) ? endrest : elsize;
 
       if (!value_bits_synthetic_pointer (c->val,
-					 c->indices[i] * elsize + startoffset,
-					 length))
+					 c->indices[i] * elsize + comp_offset,
+					 comp_length))
 	return 0;
     }
 

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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