quiet down some build warnings with Qt under OSX clang++

This commit is contained in:
nhmall
2020-07-17 18:37:07 -04:00
parent 84b598e489
commit f6b4306ce6
16 changed files with 55 additions and 50 deletions

View File

@@ -114,6 +114,7 @@ endif # WANT_WIN_X11
ifdef WANT_WIN_QT
CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS
CFLAGS += -Wno-deprecated-declarations
CFLAGS += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags)
WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs)
LINK=$(CXX)

View File

@@ -370,7 +370,7 @@ void NetHackQtBind::qt_display_file(const char *filename, BOOLEAN_P must_exist)
}
}
void NetHackQtBind::qt_start_menu(winid wid, unsigned long mbehavior)
void NetHackQtBind::qt_start_menu(winid wid, unsigned long mbehavior UNUSED)
{
NetHackQtWindow* window=id_to_window[(int)wid];
window->StartMenu();
@@ -427,7 +427,7 @@ void NetHackQtBind::qt_cliparound_window(winid wid, int x, int y)
NetHackQtWindow* window=id_to_window[(int)wid];
window->ClipAround(x,y);
}
void NetHackQtBind::qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph,int bkglyph)
void NetHackQtBind::qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph,int bkglyph UNUSED)
{
/* TODO: bkglyph */
NetHackQtWindow* window=id_to_window[(int)wid];
@@ -681,7 +681,7 @@ bool NetHackQtBind::notify(QObject *receiver, QEvent *event)
bool macro=false;
for (int i=0; !macro && key_macro[i].key; i++) {
if (key_macro[i].key==k
&& ((key_macro[i].state&key_event->modifiers())==key_macro[i].state))
&& ((key_macro[i].state&key_event->modifiers()) == (unsigned int) key_macro[i].state))
{
keybuffer.Put(key_macro[i].macro);
macro=true;
@@ -720,9 +720,9 @@ QFrame* NetHackQtBind::splash=0;
QStringList *NetHackQtBind::msgs_strings;
boolean NetHackQtBind::msgs_saved = false;
boolean NetHackQtBind::msgs_initd = false;
#if 0
static void Qt_positionbar(char *) {}
#endif
} // namespace nethack_qt_
struct window_procs Qt_procs = {
@@ -804,7 +804,11 @@ struct window_procs Qt_procs = {
};
#ifndef WIN32
#if defined(USER_SOUNDS) && !defined(QT_NO_SOUND)
extern "C" void play_usersound(const char* filename, int volume)
#else
extern "C" void play_usersound(const char* filename UNUSED, int volume UNUSED)
#endif
{
#ifdef USER_SOUNDS
#ifndef QT_NO_SOUND

View File

@@ -34,7 +34,7 @@ void NetHackQtDelay::wait()
m_loop.exec();
}
void NetHackQtDelay::timerEvent(QTimerEvent* timer)
void NetHackQtDelay::timerEvent(QTimerEvent* timer UNUSED)
{
m_loop.exit();
killTimer(m_timer);

View File

@@ -30,7 +30,7 @@ NetHackQtLineEdit::NetHackQtLineEdit() :
{
}
NetHackQtLineEdit::NetHackQtLineEdit(QWidget* parent, const char* name) :
NetHackQtLineEdit::NetHackQtLineEdit(QWidget* parent, const char* name UNUSED) :
QLineEdit(parent)
{
}

View File

@@ -379,7 +379,7 @@ static const char * rest_xpm[] = {
" .... ",
" "};
/* XPM */
static const char * cast_a_xpm[] = {
static const char * cast_a_xpm[] UNUSED = {
"12 13 3 1",
" c None",
". c #FFFF6DB60000",
@@ -398,7 +398,7 @@ static const char * cast_a_xpm[] = {
" . X X ",
" . X X "};
/* XPM */
static const char * cast_b_xpm[] = {
static const char * cast_b_xpm[] UNUSED = {
"12 13 3 1",
" c None",
". c #FFFF6DB60000",
@@ -417,7 +417,7 @@ static const char * cast_b_xpm[] = {
" . X X ",
" . XXX "};
/* XPM */
static const char * cast_c_xpm[] = {
static const char * cast_c_xpm[] UNUSED = {
"12 13 3 1",
" c None",
". c #FFFF6DB60000",

View File

@@ -529,9 +529,9 @@ void NetHackQtMapViewport::CursorTo(int x,int y)
Changed(cursor.x(),cursor.y());
}
void NetHackQtMapViewport::PrintGlyph(int x,int y,int glyph)
void NetHackQtMapViewport::PrintGlyph(int x,int y,int theglyph)
{
Glyph(x,y)=glyph;
Glyph(x,y)=theglyph;
Changed(x,y);
}
@@ -580,7 +580,7 @@ void NetHackQtMapWindow2::clearMessages()
messages_rect = QRect();
}
void NetHackQtMapWindow2::putMessage(int attr, const QString& text)
void NetHackQtMapWindow2::putMessage(int attr UNUSED, const QString& text)
{
if ( !messages.isEmpty() )
messages += "\n";
@@ -617,7 +617,7 @@ void NetHackQtMapWindow2::CursorTo(int x,int y)
m_viewport->CursorTo(x, y);
}
void NetHackQtMapWindow2::PutStr(int attr, const QString& text)
void NetHackQtMapWindow2::PutStr(int attr UNUSED, const QString& text UNUSED)
{
puts("unexpected PutStr in MapWindow");
}

View File

@@ -241,7 +241,7 @@ int NetHackQtMenuWindow::SelectMenu(int h, MENU_ITEM_P **menu_list)
// Determine column widths
std::vector<int> col_widths;
for (std::size_t i = 0; i < itemlist.size(); ++i) {
for (std::size_t i = 0; i < (size_t) itemlist.size(); ++i) {
QStringList columns = itemlist[i].str.split("\t");
if (!itemlist[i].Selectable() && columns.size() == 1)
{
@@ -249,7 +249,7 @@ int NetHackQtMenuWindow::SelectMenu(int h, MENU_ITEM_P **menu_list)
// Assume this is a section header
continue;
}
for (std::size_t j = 0U; j < columns.size(); ++j) {
for (std::size_t j = 0U; j < (size_t) columns.size(); ++j) {
int w = fm.width(columns[j] + " \t");
if (j >= col_widths.size()) {
col_widths.push_back(w);
@@ -260,12 +260,12 @@ int NetHackQtMenuWindow::SelectMenu(int h, MENU_ITEM_P **menu_list)
}
// Pad each column to its column width
for (std::size_t i = 0U; i < itemlist.size(); ++i) {
for (std::size_t i = 0U; i < (size_t) itemlist.size(); ++i) {
QTableWidgetItem *twi = table->item(i, 4);
if (twi == NULL) { continue; }
QString text = twi->text();
QStringList columns = text.split("\t");
for (std::size_t j = 0U; j+1U < columns.size(); ++j) {
for (std::size_t j = 0U; j+1U < (size_t) columns.size(); ++j) {
columns[j] += "\t";
int width = col_widths[j];
while (fm.width(columns[j]) < width) {
@@ -396,7 +396,7 @@ void NetHackQtMenuWindow::AddRow(int row, const MenuItem& mi)
table->item(row, 4)->setFlags(Qt::ItemIsEnabled);
WidenColumn(4, fm.width(text));
if (mi.color != -1) {
if ((int) mi.color != -1) {
twi->setForeground(colors[mi.color]);
}
@@ -497,7 +497,7 @@ void NetHackQtMenuWindow::keyPressEvent(QKeyEvent* event)
InputCount(key);
else {
for (int i=0; i<itemcount; i++) {
if (itemlist[i].ch == key || itemlist[i].gch == key)
if ((unsigned int) itemlist[i].ch == key || (unsigned int) itemlist[i].gch == key)
ToggleSelect(i);
}
}
@@ -581,7 +581,7 @@ void NetHackQtMenuWindow::ToggleSelect(int i)
}
}
void NetHackQtMenuWindow::cellToggleSelect(int i, int j)
void NetHackQtMenuWindow::cellToggleSelect(int i, int j UNUSED)
{
ToggleSelect(i);
}
@@ -651,7 +651,7 @@ bool NetHackQtTextWindow::Destroy()
return !isVisible();
}
void NetHackQtTextWindow::UseRIP(int how, time_t when)
void NetHackQtTextWindow::UseRIP(int how, time_t when UNUSED)
{
// Code from X11 windowport
#define STONE_LINE_LEN 16 /* # chars that fit on one line */
@@ -719,7 +719,7 @@ void NetHackQtTextWindow::Clear()
str_fixed=false;
}
void NetHackQtTextWindow::Display(bool block)
void NetHackQtTextWindow::Display(bool block UNUSED)
{
if (str_fixed) {
lines->setFont(qt_settings->normalFixedFont());
@@ -752,7 +752,7 @@ void NetHackQtTextWindow::Display(bool block)
exec();
}
void NetHackQtTextWindow::PutStr(int attr, const QString& text)
void NetHackQtTextWindow::PutStr(int attr UNUSED, const QString& text)
{
str_fixed=str_fixed || text.contains(" ");
lines->addItem(text);

View File

@@ -63,7 +63,7 @@ void NetHackQtMessageWindow::updateFont()
map->setFont(qt_settings->normalFont());
}
void NetHackQtMessageWindow::Scroll(int dx, int dy)
void NetHackQtMessageWindow::Scroll(int dx UNUSED, int dy UNUSED)
{
//RLC Is this necessary?
//RLC list->Scroll(dx,dy);
@@ -81,7 +81,7 @@ void NetHackQtMessageWindow::ClearMessages()
list->clear();
}
void NetHackQtMessageWindow::Display(bool block)
void NetHackQtMessageWindow::Display(bool block UNUSED)
{
if (changed) {
list->repaint();
@@ -139,7 +139,7 @@ void NetHackQtMessageWindow::PutStr(int attr, const QString& text)
#endif
// ATR_BLINK not supported
if (list->count() >= ::iflags.msg_history)
if (list->count() >= (int) ::iflags.msg_history)
delete list->item(0);
list->addItem(text2);

View File

@@ -44,7 +44,7 @@ static const char nh_attribution[] = "<center><big>NetHack %1</big>"
class NhPSListViewItem : public QTableWidgetItem {
public:
NhPSListViewItem( QTableWidget* parent, const QString& name ) :
NhPSListViewItem( QTableWidget* parent UNUSED, const QString& name ) :
QTableWidgetItem(name)
{
}
@@ -140,7 +140,7 @@ public:
}
};
NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks) :
NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks UNUSED) :
QDialog(NetHackQtBind::mainWidget()),
fully_specified_role(true)
{
@@ -184,8 +184,8 @@ NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks) :
QButtonGroup *gendergroup = new QButtonGroup(this);
QGroupBox* alignbox = new QGroupBox("Alignment",this);
QButtonGroup *aligngroup = new QButtonGroup(this);
QVBoxLayout* vbgb = new QVBoxLayout(genderbox);
QVBoxLayout* vbab = new QVBoxLayout(alignbox);
QVBoxLayout* vbgb UNUSED = new QVBoxLayout(genderbox);
QVBoxLayout* vbab UNUSED = new QVBoxLayout(alignbox);
char versionbuf[QBUFSZ];
QLabel* logo = new QLabel(QString(nh_attribution).arg(version_string(versionbuf)), this);
@@ -414,7 +414,7 @@ void NetHackQtPlayerSelector::selectRole(int crow, int ccol, int prow, int pcol)
setupOthers();
}
void NetHackQtPlayerSelector::selectRace(int crow, int ccol, int prow, int pcol)
void NetHackQtPlayerSelector::selectRace(int crow UNUSED, int ccol UNUSED, int prow, int pcol UNUSED)
{
int ra = race->currentRow();
int ro = role->currentRow();

View File

@@ -71,7 +71,7 @@ QSize NetHackQtRIP::sizeHint() const
return pixmap->size();
}
void NetHackQtRIP::paintEvent(QPaintEvent* event)
void NetHackQtRIP::paintEvent(QPaintEvent* event UNUSED)
{
if ( riplines ) {
int pix_x=(width()-pixmap->width())/2;

View File

@@ -41,7 +41,7 @@ namespace nethack_qt_ {
#define TILEWMIN 6
#define TILEHMIN 6
NetHackQtSettings::NetHackQtSettings(int w, int h) :
NetHackQtSettings::NetHackQtSettings(int w UNUSED, int h UNUSED) :
settings(),
tilewidth(this),
tileheight(this),
@@ -151,7 +151,7 @@ void NetHackQtSettings::toggleGlyphSize()
whichsize.toggle();
}
void NetHackQtSettings::setGlyphSize(bool which)
void NetHackQtSettings::setGlyphSize(bool which UNUSED)
{
QSize n = QSize(tilewidth.value(),tileheight.value());
if ( othersize.isValid() ) {

View File

@@ -211,14 +211,14 @@ QWidget* NetHackQtStatusWindow::Widget() { return this; }
void NetHackQtStatusWindow::Clear()
{
}
void NetHackQtStatusWindow::Display(bool block)
void NetHackQtStatusWindow::Display(bool block UNUSED)
{
}
void NetHackQtStatusWindow::CursorTo(int,int y)
{
cursy=y;
}
void NetHackQtStatusWindow::PutStr(int attr, const QString& text)
void NetHackQtStatusWindow::PutStr(int attr UNUSED, const QString& text UNUSED)
{
// do a complete update when line 0 is done (as per X11 fancy status)
if (cursy==0) updateStats();

View File

@@ -35,7 +35,7 @@ QString str_titlecase(const QString& str)
QString nh_capitalize_words(const QString& str)
{
QStringList words = str.split(" ");
for (size_t i = 0; i < words.size(); ++i) {
for (size_t i = 0; i < (size_t) words.size(); ++i) {
words[i] = str_titlecase(words[i]);
}
return words.join(" ");

View File

@@ -62,7 +62,7 @@ NetHackQtSavedGameSelector::NetHackQtSavedGameSelector(const char** saved) :
QGroupBox* box = new QGroupBox("Saved Characters",this);
QButtonGroup *bg = new QButtonGroup(this);
vbl->addWidget(box);
QVBoxLayout *bgl = new QVBoxLayout(box);
QVBoxLayout *bgl UNUSED = new QVBoxLayout(box);
connect(bg, SIGNAL(buttonPressed(int)), this, SLOT(done(int)));
for (int i=0; saved[i]; i++) {
QPushButton* b = new QPushButton(saved[i],box);

View File

@@ -121,18 +121,18 @@ NetHackQtWindow::~NetHackQtWindow()
// XXX Use "expected ..." for now, abort or default later.
//
void NetHackQtWindow::Clear() { puts("unexpected Clear"); }
void NetHackQtWindow::Display(bool block) { puts("unexpected Display"); }
void NetHackQtWindow::Display(bool block UNUSED) { puts("unexpected Display"); }
bool NetHackQtWindow::Destroy() { return true; }
void NetHackQtWindow::CursorTo(int x,int y) { puts("unexpected CursorTo"); }
void NetHackQtWindow::PutStr(int attr, const QString& text) { puts("unexpected PutStr"); }
void NetHackQtWindow::CursorTo(int x UNUSED,int y UNUSED) { puts("unexpected CursorTo"); }
void NetHackQtWindow::PutStr(int attr UNUSED, const QString& text UNUSED) { puts("unexpected PutStr"); }
void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); }
void NetHackQtWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr,
const QString& str, unsigned itemflags) { puts("unexpected AddMenu"); }
void NetHackQtWindow::EndMenu(const QString& prompt) { puts("unexpected EndMenu"); }
int NetHackQtWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) { puts("unexpected SelectMenu"); return 0; }
void NetHackQtWindow::ClipAround(int x,int y) { puts("unexpected ClipAround"); }
void NetHackQtWindow::PrintGlyph(int x,int y,int glyph) { puts("unexpected PrintGlyph"); }
void NetHackQtWindow::AddMenu(int glyph UNUSED, const ANY_P* identifier UNUSED, char ch UNUSED, char gch UNUSED, int attr UNUSED,
const QString& str UNUSED, unsigned itemflags UNUSED) { puts("unexpected AddMenu"); }
void NetHackQtWindow::EndMenu(const QString& prompt UNUSED) { puts("unexpected EndMenu"); }
int NetHackQtWindow::SelectMenu(int how UNUSED, MENU_ITEM_P **menu_list UNUSED) { puts("unexpected SelectMenu"); return 0; }
void NetHackQtWindow::ClipAround(int x UNUSED,int y UNUSED) { puts("unexpected ClipAround"); }
void NetHackQtWindow::PrintGlyph(int x UNUSED,int y UNUSED,int glyph UNUSED) { puts("unexpected PrintGlyph"); }
//void NetHackQtWindow::PrintGlyphCompose(int x,int y,int,int) { puts("unexpected PrintGlyphCompose"); }
void NetHackQtWindow::UseRIP(int how, time_t when) { puts("unexpected UseRIP"); }
void NetHackQtWindow::UseRIP(int how UNUSED, time_t when UNUSED) { puts("unexpected UseRIP"); }
} // namespace nethack_qt_

View File

@@ -184,7 +184,7 @@ char NetHackQtYnDialog::Exec()
show();
char choice=0;
char ch_esc=0;
for (uint i=0; i<ch.length(); i++) {
for (uint i=0; i< (uint) ch.length(); i++) {
if (ch[i].unicode()=='q') ch_esc='q';
else if (!ch_esc && ch[i].unicode()=='n') ch_esc='n';
}