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.

---------------------
This commit is contained in:
nhmall
2022-01-31 15:11:05 -05:00
parent ac3c005615
commit ae11c6e25d
3 changed files with 13 additions and 5 deletions

View File

@@ -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();

View File

@@ -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);
}

View File

@@ -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;