From 8dc8416ed7134866db4e34ff6f42f604644dac9b Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 14 Aug 2023 17:09:47 +0930 Subject: [PATCH] plugins/renepay: fix gcc-12.3.0 -O3 warning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compiler can't tell that we always set have_state[PAY_FLOW_FAILED_FINAL] when we set this: ``` plugins/renepay/payment.c: In function ‘payment_reconsider’: plugins/renepay/payment.c:287:25: error: ‘final_error’ may be used uninitialized [-Werror=maybe-uninitialized] 287 | payment_fail(payment, final_error, "%s", final_msg); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ plugins/renepay/payment.c:194:30: note: ‘final_error’ was declared here 194 | enum jsonrpc_errcode final_error, ecode; | ^~~~~~~~~~~ plugins/renepay/payment.c:287:25: error: ‘final_msg’ may be used uninitialized [-Werror=maybe-uninitialized] 287 | payment_fail(payment, final_error, "%s", final_msg); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ plugins/renepay/payment.c:195:21: note: ‘final_msg’ was declared here 195 | const char *final_msg; | ^~~~~~~~~ ``` Signed-off-by: Rusty Russell --- plugins/renepay/payment.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/renepay/payment.c b/plugins/renepay/payment.c index da4016284..26be01e6b 100644 --- a/plugins/renepay/payment.c +++ b/plugins/renepay/payment.c @@ -191,8 +191,8 @@ void payment_reconsider(struct payment *payment) { struct pay_flow *i, *next; bool have_state[NUM_PAY_FLOW] = {false}; - enum jsonrpc_errcode final_error, ecode; - const char *final_msg; + enum jsonrpc_errcode final_error COMPILER_WANTS_INIT("gcc 12.3.0 -O3"), ecode; + const char *final_msg COMPILER_WANTS_INIT("gcc 12.3.0 -O3"); const char *errmsg; plugin_log(pay_plugin->plugin, LOG_DBG, "payment_reconsider");