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