1*4882a593SmuzhiyunFrom 91d0dee6ab50de5103e417a03de92ca73afbb7c7 Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Joseph Myers <joseph@codesourcery.com>
3*4882a593SmuzhiyunDate: Wed, 2 Oct 2019 21:12:17 +0000
4*4882a593SmuzhiyunSubject: [PATCH 18/20] Disable -Wmaybe-uninitialized for total_deadline in
5*4882a593Smuzhiyun sunrpc/clnt_udp.c.
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunTo work around <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691>
8*4882a593Smuzhiyunfor RV32, we recently disabled -Wmaybe-uninitialized for some inline
9*4882a593Smuzhiyunfunctions in inet/net-internal.h, as included by sunrpc/clnt_udp.c.
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunThe same error has now appeared with current GCC trunk for MIPS, in a
12*4882a593Smuzhiyunform that is located at the definition of the variable in question and
13*4882a593Smuzhiyunso unaffected by the disabling in inet/net-internal.h.  Thus, this
14*4882a593Smuzhiyunpatch adds the same disabling around the definition of that variable,
15*4882a593Smuzhiyunto cover the MIPS case.
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunTested with build-many-glibcs.py (compilers and glibcs stages) for
18*4882a593Smuzhiyunmips64-linux-gnu with GCC mainline.
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun	* sunrpc/clnt_udp.c: Include <libc-diag.h>.
21*4882a593Smuzhiyun	(clntudp_call): Disable -Wmaybe-uninitialized around declaration
22*4882a593Smuzhiyun	of total_deadline.
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun(cherry picked from commit 2334a78a4982f8d594e8da8f29d9e06ee5c15824)
25*4882a593SmuzhiyunSigned-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
26*4882a593Smuzhiyun---
27*4882a593Smuzhiyun sunrpc/clnt_udp.c | 11 +++++++++++
28*4882a593Smuzhiyun 1 file changed, 11 insertions(+)
29*4882a593Smuzhiyun
30*4882a593Smuzhiyundiff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
31*4882a593Smuzhiyunindex c2436e3e..ee79b09b 100644
32*4882a593Smuzhiyun--- a/sunrpc/clnt_udp.c
33*4882a593Smuzhiyun+++ b/sunrpc/clnt_udp.c
34*4882a593Smuzhiyun@@ -57,6 +57,7 @@
35*4882a593Smuzhiyun #include <kernel-features.h>
36*4882a593Smuzhiyun #include <inet/net-internal.h>
37*4882a593Smuzhiyun #include <shlib-compat.h>
38*4882a593Smuzhiyun+#include <libc-diag.h>
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun extern u_long _create_xid (void);
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun@@ -290,7 +291,17 @@ clntudp_call (/* client handle */
43*4882a593Smuzhiyun   int anyup;			/* any network interface up */
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun   struct deadline_current_time current_time = __deadline_current_time ();
46*4882a593Smuzhiyun+  /* GCC 10 for MIPS reports total_deadline as possibly used
47*4882a593Smuzhiyun+     uninitialized; see
48*4882a593Smuzhiyun+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691>.  In fact it
49*4882a593Smuzhiyun+     is initialized conditionally and only ever used under the same
50*4882a593Smuzhiyun+     condition.  The same warning is also disabled in
51*4882a593Smuzhiyun+     inet/net-internal.h because in some other configurations GCC
52*4882a593Smuzhiyun+     gives the warning in an inline function.  */
53*4882a593Smuzhiyun+  DIAG_PUSH_NEEDS_COMMENT;
54*4882a593Smuzhiyun+  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
55*4882a593Smuzhiyun   struct deadline total_deadline; /* Determined once by overall timeout.  */
56*4882a593Smuzhiyun+  DIAG_POP_NEEDS_COMMENT;
57*4882a593Smuzhiyun   struct deadline response_deadline; /* Determined anew for each query.  */
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun   /* Choose the timeout value.  For non-sending usage (xargs == NULL),
60*4882a593Smuzhiyun--
61*4882a593Smuzhiyun2.20.1
62*4882a593Smuzhiyun
63