From: nhmall Date: Mon, 31 Jan 2022 20:11:05 +0000 (-0500) Subject: some warnings with clang version 13.0.0-9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ae11c6e25d325aea075f72dc576c965d09eaedb6;p=nethack some warnings with clang version 13.0.0-9 --------------------- win/curses/cursstat.c: ../win/curses/cursstat.c:301:9: warning: variable 'height' set but not used [-Wunused-but-set-variable] height, width, w, xtra, clen, x, y, t, ex, ey, ^ 1 warning generated. --------------------- win/Qt/qt_menu.cpp: ../win/Qt/qt_menu.cpp:1123:9: warning: variable 'h' set but not used [-Wunused-but-set-variable] int h=0; ^ 1 warning generated. --------------------- /win/Qt/qt_yndlg.cpp: ../win/Qt/qt_yndlg.cpp:170:6: warning: variable 'x' set but not used [-Wunused-but-set-variable] int x=margin, y=extra+margin; ^ ../win/Qt/qt_yndlg.cpp:170:16: warning: variable 'y' set but not used [-Wunused-but-set-variable] int x=margin, y=extra+margin; ^ 2 warnings generated. Commenting out the x and y references, then leads to the following additional warnings, so comment those out too: ../win/Qt/qt_yndlg.cpp:167:12: warning: unused variable 'margin' [-Wunused-variable] const int margin=8; ^ ../win/Qt/qt_yndlg.cpp:168:12: warning: unused variable 'gutter' [-Wunused-variable] const int gutter=8; ^ ../win/Qt/qt_yndlg.cpp:169:12: warning: unused variable 'extra' [-Wunused-variable] const int extra=fontMetrics().height(); // Extra for group ^ 3 warnings generated. --------------------- --- diff --git a/win/Qt/qt_menu.cpp b/win/Qt/qt_menu.cpp index 202769bfa..e55c9dc6a 100644 --- a/win/Qt/qt_menu.cpp +++ b/win/Qt/qt_menu.cpp @@ -1120,14 +1120,16 @@ void NetHackQtTextWindow::Display(bool block UNUSED) lines->setFont(qt_settings->normalFont()); } - int h=0; + /* int h=0; */ if (use_rip) { - h+=rip.height(); + /* h+=rip.height(); */ + (void) rip.height(); ok.hide(); search.hide(); rip.show(); } else { - h+=ok.height()*2 + 7; + /* h+=ok.height()*2 + 7; */ + (void) ok.height(); ok.show(); search.show(); rip.hide(); diff --git a/win/Qt/qt_yndlg.cpp b/win/Qt/qt_yndlg.cpp index 89b132eb3..cd1e7e61d 100644 --- a/win/Qt/qt_yndlg.cpp +++ b/win/Qt/qt_yndlg.cpp @@ -164,11 +164,13 @@ char NetHackQtYnDialog::Exec() is_yn = (ch == QString("yn")), // [Yes ][ No ] is_lr = (ch == QString(lrq)); // [ Left ][Right ] +#if 0 const int margin=8; const int gutter=8; const int extra=fontMetrics().height(); // Extra for group int x=margin, y=extra+margin; - int butheight = fontMetrics().height() * 2 + 5, +#endif + int butheight = fontMetrics().height() * 2 + 5, butwidth = (butheight - 5) * ((is_ynq || is_lr) ? 3 : (is_ynaq || is_yn) ? 2 : 1) + 5; if (butwidth == butheight) { // square, enough room for C or ^C @@ -275,6 +277,7 @@ char NetHackQtYnDialog::Exec() button->setFixedSize(butwidth, butheight); if (ch[i] == def) button->setDefault(true); +#if 0 // 'x' and 'y' don't seem to actually used anywhere // and limit of 10 buttons per row isn't enforced if (i % 10 == 9) { @@ -284,6 +287,7 @@ char NetHackQtYnDialog::Exec() } else { x += butwidth + gutter; } +#endif groupbox->addWidget(button); bgroup->addButton(button, i); } diff --git a/win/curses/cursstat.c b/win/curses/cursstat.c index 2631ae863..be4c57c50 100644 --- a/win/curses/cursstat.c +++ b/win/curses/cursstat.c @@ -298,7 +298,9 @@ draw_horizontal(boolean border) #endif int i, j, number_of_lines, cap_and_hunger, exp_points, sho_score, - height, width, w, xtra, clen, x, y, t, ex, ey, + /* both height and width get their values set, + * but only width gets used in this function */ + height UNUSED, width, w, xtra, clen, x, y, t, ex, ey, condstart = 0, conddummy = 0; #ifdef STATUS_HILITES int coloridx = NO_COLOR, attrmask = 0;