From 65646e2a8c8c2d515d47fddea74ccbb592b98866 Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 21 May 2026 10:36:22 -0400 Subject: [PATCH] fix recently appearing warnings in clang-22 and visual studio clang-22: invent.c:2621:16: warning: variable 'option' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] 2621 | } else if (!hit_reroll_limit(u.uroleplay.numrerolls)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ invent.c:2629:9: note: uninitialized use occurs here 2629 | if (option == 'y') { | ^~~~~~ invent.c:2621:12: note: remove the 'if' if its condition is always true 2621 | } else if (!hit_reroll_limit(u.uroleplay.numrerolls)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ invent.c:2570:16: note: initialize the variable 'option' to silence this warning 2570 | char option; | ^ | = '\0' 1 warning generated. visual studio: src/invent.c(2629,1): warning C4701: potentially uninitialized local variable 'option' used --- src/invent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/invent.c b/src/invent.c index 228eacd12..29a4026ef 100644 --- a/src/invent.c +++ b/src/invent.c @@ -2567,7 +2567,7 @@ reroll_menu(void) struct obj *otmp; int tmpglyph; glyph_info tmpglyphinfo; - char option; + char option = 'n'; char buf[BUFSZ]; win = create_nhwindow(NHW_MENU);