From: Siddhesh Poyarekar Date: Wed, 9 Jul 2014 05:06:50 +0000 (+0530) Subject: Fix -Wmaybe-uninitialized warning in xdr.c X-Git-Tag: glibc-2.20~123 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ee3eab42979fdd5bb971a40fec32e04bb9dd2ad;p=thirdparty%2Fglibc.git Fix -Wmaybe-uninitialized warning in xdr.c While we're at fixing build warnings, here's one unnecessary warning that can be fixed fairly easily. The SIZE variable is never actually use uninitialized, but the compiler cannot make that out and thinks (correctly) that there is a potential for accessing SIZE without initializing it. Make this safe by initializing SIZE to 0. Tested on x86_64. --- diff --git a/ChangeLog b/ChangeLog index b70d3370a54..0773d7ce18a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-07-09 Siddhesh Poyarekar + * sunrpc/xdr.c (xdr_string): Initialize SIZE to 0. + * sysdeps/generic/unwind-pe.h: Only check if __cplusplus is defined. diff --git a/sunrpc/xdr.c b/sunrpc/xdr.c index b3f96ca4dc2..129abd8f001 100644 --- a/sunrpc/xdr.c +++ b/sunrpc/xdr.c @@ -739,7 +739,7 @@ xdr_string (xdrs, cpp, maxsize) u_int maxsize; { char *sp = *cpp; /* sp is the actual string pointer */ - u_int size; + u_int size = 0; u_int nodesize; /*