This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Fix unitialized warning in macroexp.c
- From: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- To: gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Thu, 31 Mar 2011 12:41:10 -0300
- Subject: [commit] Fix unitialized warning in macroexp.c
Hi,
When compiling with -O3 (gcc 4.4.5), the build fails with:
cc1: warnings being treated as errors
/home/bauermann/trabalho/src/src/gdb/macroexp.c: In function âmaybe_expandâ:
/home/bauermann/trabalho/src/src/gdb/macroexp.c:1186: error: âva_arg_name.lenâ may be used uninitialized in this function
/home/bauermann/trabalho/src/src/gdb/macroexp.c:1186: note: âva_arg_name.lenâ was declared here
/home/bauermann/trabalho/src/src/gdb/macroexp.c:1186: error: âva_arg_name.textâ may be used uninitialized in this function
/home/bauermann/trabalho/src/src/gdb/macroexp.c:1186: note: âva_arg_name.textâ was declared here
make: *** [macroexp.o] Error 1
I committed the following patch to fix the build.
--
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center
2011-03-31 Thiago Jung Bauermann <bauerman@br.ibm.com>
* macroexp.c (expand): Avoid uninitialized variable
compiler warning.
Index: macroexp.c
===================================================================
RCS file: /cvs/src/src/gdb/macroexp.c,v
retrieving revision 1.26
diff -u -r1.26 macroexp.c
--- macroexp.c 9 Jan 2011 03:20:33 -0000 1.26
+++ macroexp.c 31 Mar 2011 15:39:41 -0000
@@ -1183,7 +1183,7 @@
struct macro_buffer *argv = NULL;
struct macro_buffer substituted;
struct macro_buffer substituted_src;
- struct macro_buffer va_arg_name;
+ struct macro_buffer va_arg_name = {0};
int is_varargs = 0;
if (def->argc >= 1)