Avoid compilation failure with remote-m32r-sdi.o
Commit Message
Hi.
I'm tripping over this with --enable-targets=all.
../../binutils-gdb/gdb/remote-m32r-sdi.c: In function 'm32r_open':
../../binutils-gdb/gdb/remote-m32r-sdi.c:411:21: error: 'val' may be used
uninitialized in this function [-Werror=maybe-uninitialized]
max_access_breaks = recv_char_data ();
^
../../binutils-gdb/gdb/remote-m32r-sdi.c:401:22: error: 'val' may be used
uninitialized in this function [-Werror=maybe-uninitialized]
max_ib_breakpoints = recv_char_data ();
^
cc1: all warnings being treated as errors
The code here isn't checking the return code of recv_data:
static unsigned char
recv_char_data (void)
{
unsigned char val = 0;
recv_data (&val, 1);
return val;
}
I don't want to spend too much time on this, so for now
I'm just fixing the compilation failure.
2016-02-03 Doug Evans <dje@google.com>
* remote-m32r-sdi.c (recv_char_data): Initialize val to avoid
compiler warning.
(recv_long_data): Ditto.
return val;
@@ -279,7 +279,7 @@ recv_char_data (void)
static unsigned long
recv_long_data (void)
{
- unsigned long val;
+ unsigned long val = 0; /* -Wall */
recv_data (&val, 4);
return ntohl (val);
@@ -270,7 +270,7 @@ send_three_arg_cmd (unsigned char cmd, unsigned long
arg1, unsigned long arg2,
static unsigned char
recv_char_data (void)
{
- unsigned char val;
+ unsigned char val = 0; /* -Wall */
recv_data (&val, 1);