]> granicus.if.org Git - nethack/commitdiff
some warnings with clang version 13.0.0-9
authornhmall <nhmall@nethack.org>
Mon, 31 Jan 2022 20:11:05 +0000 (15:11 -0500)
committernhmall <nhmall@nethack.org>
Mon, 31 Jan 2022 20:11:05 +0000 (15:11 -0500)
---------------------
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.

---------------------

win/Qt/qt_menu.cpp
win/Qt/qt_yndlg.cpp
win/curses/cursstat.c

index 202769bfac43760de74626b12a5c6088799379d3..e55c9dc6a0df1ca48c2cbb8b5d240d52bda3ae2a 100644 (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();
index 89b132eb3e9d6ad59fd961c015749be795d55833..cd1e7e61d715a73366dde4b28224cbb20f881805 100644 (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);
        }
index 2631ae863d22b9268cd8c140aeabe6f80dd63feb..be4c57c50e9b6feebde03e801aae78ec67610209 100644 (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;