From 23b662c2aac8fd45792ea4394c5ca7a04804a89c Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 30 Mar 2019 17:30:56 -0500 Subject: [PATCH] [nostalgia] Enable and fix -Wextra warnings --- CMakeLists.txt | 2 +- src/nostalgia/core/qt/gfx.cpp | 10 +++++----- src/nostalgia/studio/lib/json_test.cpp | 2 +- src/nostalgia/studio/lib/oxfstreeview.cpp | 6 +++--- src/nostalgia/studio/lib/plugin.cpp | 6 +++--- src/nostalgia/studio/mainwindow.cpp | 4 ++-- src/nostalgia/tools/pack/pack.cpp | 6 +++--- src/nostalgia/world/studio/worldeditor.cpp | 6 ++---- src/nostalgia/world/world.hpp | 4 ++-- 9 files changed, 22 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b16923d3..de80aabc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ endif() if(NOT MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") - #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-align") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wdouble-promotion") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat=2") diff --git a/src/nostalgia/core/qt/gfx.cpp b/src/nostalgia/core/qt/gfx.cpp index aa271894..42935a17 100644 --- a/src/nostalgia/core/qt/gfx.cpp +++ b/src/nostalgia/core/qt/gfx.cpp @@ -10,22 +10,22 @@ namespace nostalgia::core { -ox::Error initGfx(Context *ctx) { +ox::Error initGfx(Context*) { return 1; } -ox::Error initConsole(Context *ctx) { +ox::Error initConsole(Context*) { return 1; } -ox::Error loadTileSheet(Context *ctx, InodeId_t inode) { +ox::Error loadTileSheet(Context*, InodeId_t) { return 1; } -void puts(Context *ctx, int loc, const char *str) { +void puts(Context*, int, const char*) { } -void setTile(Context *ctx, int layer, int column, int row, uint8_t tile) { +void setTile(Context*, int, int, int, uint8_t) { } } diff --git a/src/nostalgia/studio/lib/json_test.cpp b/src/nostalgia/studio/lib/json_test.cpp index 49017e31..75aaa0c6 100644 --- a/src/nostalgia/studio/lib/json_test.cpp +++ b/src/nostalgia/studio/lib/json_test.cpp @@ -51,7 +51,7 @@ Error model(T *io, TestStruct *obj) { return err; } -int main(int argc, char **args) { +int main() { int err = 0; QString json; TestStruct ts = { diff --git a/src/nostalgia/studio/lib/oxfstreeview.cpp b/src/nostalgia/studio/lib/oxfstreeview.cpp index ffa5b1c7..ee782724 100644 --- a/src/nostalgia/studio/lib/oxfstreeview.cpp +++ b/src/nostalgia/studio/lib/oxfstreeview.cpp @@ -26,7 +26,7 @@ OxFSFile::OxFSFile(PassThroughFS *fs, QString path, OxFSFile *parentItem) { auto stat = fs->stat(static_cast(m_path.toUtf8())); if (!stat.error) { if (stat.value.fileType == FileType_Directory) { - fs->ls(m_path.toUtf8(), [&ls](const char *name, ox::InodeId_t inode) { + fs->ls(m_path.toUtf8(), [&ls](const char *name, ox::InodeId_t) { ls.push_back(name); return OxError(0); }); @@ -115,7 +115,7 @@ QString OxFSFile::name() const { // OxFSModel -OxFSModel::OxFSModel(PassThroughFS *fs, QObject *parent) { +OxFSModel::OxFSModel(PassThroughFS *fs, QObject*) { m_rootItem = new OxFSFile(fs, ""); } @@ -213,7 +213,7 @@ void OxFSModel::updateFile(QString path) { m_rootItem->appendChild(this, pathItems, ""); } -void OxFSModel::setupModelData(const QStringList &lines, OxFSFile *parent) { +void OxFSModel::setupModelData(const QStringList&, OxFSFile*) { } } diff --git a/src/nostalgia/studio/lib/plugin.cpp b/src/nostalgia/studio/lib/plugin.cpp index f79f2908..d495dffb 100644 --- a/src/nostalgia/studio/lib/plugin.cpp +++ b/src/nostalgia/studio/lib/plugin.cpp @@ -11,15 +11,15 @@ namespace nostalgia { namespace studio { -QVector Plugin::newWizards(const Context *ctx) { +QVector Plugin::newWizards(const Context*) { return {}; } -QVector Plugin::importWizards(const Context *ctx) { +QVector Plugin::importWizards(const Context*) { return {}; } -QWidget *Plugin::makeEditor(QString path, const Context *ctx) { +QWidget *Plugin::makeEditor(QString, const Context*) { return nullptr; } diff --git a/src/nostalgia/studio/mainwindow.cpp b/src/nostalgia/studio/mainwindow.cpp index 015cea8b..503da72e 100644 --- a/src/nostalgia/studio/mainwindow.cpp +++ b/src/nostalgia/studio/mainwindow.cpp @@ -190,7 +190,7 @@ QAction *MainWindow::addAction(QMenu *menu, QString text, QString toolTip, return action; } -int MainWindow::readState(QString path) { +int MainWindow::readState(QString) { int err = 0; QSettings settings(m_profile.orgName, m_profile.appName); @@ -206,7 +206,7 @@ int MainWindow::readState(QString path) { return err; } -int MainWindow::writeState(QString path) { +int MainWindow::writeState(QString) { int err = 0; // generate JSON for application specific state info diff --git a/src/nostalgia/tools/pack/pack.cpp b/src/nostalgia/tools/pack/pack.cpp index 4ff50606..a582fb75 100644 --- a/src/nostalgia/tools/pack/pack.cpp +++ b/src/nostalgia/tools/pack/pack.cpp @@ -19,18 +19,18 @@ namespace nostalgia { } // stub for now -ox::Error pathToInode(std::vector *buff) { +ox::Error pathToInode(std::vector*) { return OxError(0); } // stub for now -ox::Error toMetalClaw(std::vector *buff) { +ox::Error toMetalClaw(std::vector*) { return OxError(0); } ox::Error copy(ox::PassThroughFS *src, ox::FileSystem32 *dest, std::string path) { // copy - src->ls(path.c_str(), [src, dest, path](const char *name, ox::InodeId_t inode) { + src->ls(path.c_str(), [src, dest, path](const char *name, ox::InodeId_t) { auto stat = src->stat(path.c_str()); oxReturnError(stat.error); if (stat.value.fileType == ox::FileType_Directory) { diff --git a/src/nostalgia/world/studio/worldeditor.cpp b/src/nostalgia/world/studio/worldeditor.cpp index af3ba845..c6943a76 100644 --- a/src/nostalgia/world/studio/worldeditor.cpp +++ b/src/nostalgia/world/studio/worldeditor.cpp @@ -8,13 +8,11 @@ #include "worldeditor.hpp" -namespace nostalgia { -namespace world { +namespace nostalgia::world { using namespace studio; -WorldEditor::WorldEditor(QString path, const Context *ctx) { +WorldEditor::WorldEditor(QString, const Context*) { } } -} diff --git a/src/nostalgia/world/world.hpp b/src/nostalgia/world/world.hpp index 0f005618..b9f3aaeb 100644 --- a/src/nostalgia/world/world.hpp +++ b/src/nostalgia/world/world.hpp @@ -94,14 +94,14 @@ struct Region { }; template -ox::Error modelRead(T *io, Region *obj) { +ox::Error modelRead(T *io, Region*) { ox::Error err = 0; io->setTypeInfo("nostalgia::World::Region", Region::Fields); return err; } template -ox::Error modelWrite(T *io, Region *obj) { +ox::Error modelWrite(T *io, Region*) { ox::Error err = 0; io->setTypeInfo("nostalgia::World::Region", Region::Fields); return err;