[python][patch] And range method to type

Phil Muldoon pmuldoon@redhat.com
Wed Dec 9 07:52:00 GMT 2009


On 12/09/2009 03:00 AM, Hui Zhu wrote:
> cc1: warnings being treated as errors
> ../../src/gdb/python/py-type.c: In function 'typy_range':
> ../../src/gdb/python/py-type.c:285: warning: 'high' may be used
> uninitialized in this function
> ../../src/gdb/python/py-type.c:285: warning: 'low' may be used
> uninitialized in this function
> make[2]: *** [py-type.o] Error 1
> make[2]: Leaving directory `/home/teawater/gdb/cvs/bgdb/gdb'
> make[1]: *** [all-gdb] Error 2
> make[1]: Leaving directory `/home/teawater/gdb/cvs/bgdb'
> make: *** [all] Error 2


I've checked in the following patch under the obvious rule to appease
these warnings.  I do not see them on my compiler, but it looks like
some versions might trigger the (bogus, imo ;) warning:


--

Index: python/py-type.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-type.c,v
retrieving revision 1.4
diff -u -r1.4 py-type.c
--- python/py-type.c	8 Dec 2009 14:06:02 -0000	1.4
+++ python/py-type.c	9 Dec 2009 07:47:34 -0000
@@ -282,7 +282,8 @@
   struct type *type = ((type_object *) self)->type;
   PyObject *result;
   PyObject *low_bound = NULL, *high_bound = NULL;
-  LONGEST low, high;
+  /* Initialize these to appease GCC warnings.  */
+  LONGEST low = 0, high = 0;



More information about the Gdb-patches mailing list