This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] fix gcc warnings
- From: dje at google dot com (Doug Evans)
- To: gdb-patches at sourceware dot org
- Date: Mon, 9 Jan 2012 14:33:18 -0800 (PST)
- Subject: [commit] fix gcc warnings
Hi.
Simple fix to avoid some gcc warnings.
cc1: warnings being treated as errors
../../src/gdb/gdbtypes.c: In function 'safe_parse_type':
../../src/gdb/gdbtypes.c:1698: error: 'type' may be used uninitialized in this function
cc1: warnings being treated as errors
../../src/gdb/varobj.c: In function 'varobj_set_value':
../../src/gdb/varobj.c:1420: error: 'val' may be used uninitialized in this function
../../src/gdb/varobj.c:1402: error: 'value' may be used uninitialized in this function
2012-01-09 Doug Evans <dje@google.com>
* gdbtypes.c (safe_parse_type): Initialize type to keep gcc happy.
* varobj.c (varobj_set_value): Initialize val,value to keep gcc happy.
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.224
diff -u -p -r1.224 gdbtypes.c
--- gdbtypes.c 9 Jan 2012 20:27:48 -0000 1.224
+++ gdbtypes.c 9 Jan 2012 22:29:19 -0000
@@ -1674,7 +1674,7 @@ static struct type *
safe_parse_type (struct gdbarch *gdbarch, char *p, int length)
{
struct ui_file *saved_gdb_stderr;
- struct type *type;
+ struct type *type = NULL; /* Initialize to keep gcc happy. */
volatile struct gdb_exception except;
/* Suppress error messages. */
Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.186
diff -u -p -r1.186 varobj.c
--- varobj.c 9 Jan 2012 20:27:49 -0000 1.186
+++ varobj.c 9 Jan 2012 22:29:19 -0000
@@ -1359,13 +1359,12 @@ varobj_get_value (struct varobj *var)
int
varobj_set_value (struct varobj *var, char *expression)
{
- struct value *val;
-
+ struct value *val = NULL; /* Initialize to keep gcc happy. */
/* The argument "expression" contains the variable's new value.
We need to first construct a legal expression for this -- ugh! */
/* Does this cover all the bases? */
struct expression *exp;
- struct value *value;
+ struct value *value = NULL; /* Initialize to keep gcc happy. */
int saved_input_radix = input_radix;
char *s = expression;
volatile struct gdb_exception except;