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]

[RFA] Fix compilation failure in parse_escape


Today's snapshot fails to compile:

  gcc -g -O2   -I. -I.././gdb -I.././gdb/common -I.././gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I.././gdb/../include/opcode -I.././gdb/../readline/.. -I../bfd -I.././gdb/../bfd -I.././gdb/../include -I../libdecnumber -I.././gdb/../libdecnumber  -I.././gdb/gnulib -Ignulib  -DMI_OUT=1 -DTUI=1  -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wno-switch -Wno-char-subscripts -Werror -c -o utils.o -MT utils.o -MMD -MP -MF .deps/utils.Tpo utils.c
  cc1: warnings being treated as errors
  utils.c: In function 'parse_escape':
  utils.c:1621: warning: 'target_char' may be used uninitialized in this function
  make[2]: *** [utils.o] Error 1

I think this happens because host_char_to_target sets its target_c
argument only under certain conditions.  Is the following patch the
right fix?

2009-04-15  Eli Zaretskii  <eliz@gnu.org>

	* utils.c (parse_escape): Initialize target_char to pacify GCC.

Index: gdb/utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.208
diff -u -r1.208 utils.c
--- gdb/utils.c	20 Mar 2009 23:04:34 -0000	1.208
+++ gdb/utils.c	15 Apr 2009 18:45:02 -0000
@@ -1618,7 +1618,7 @@
 int
 parse_escape (char **string_ptr)
 {
-  int target_char;
+  int target_char = -2;
   int c = *(*string_ptr)++;
   switch (c)
     {


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