From 85110f7880e32d298ee2853b4c055c7aaa22662f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Fri, 5 Jan 2018 16:53:09 +0100 Subject: Fix and suppress most of the warnings --- build.sh | 2 +- qtmips_gui/coreview.cpp | 2 +- qtmips_gui/coreview/alu.cpp | 2 +- qtmips_gui/coreview/connection.cpp | 4 ++-- qtmips_gui/coreview/latch.cpp | 4 ++-- qtmips_gui/coreview/memory.cpp | 2 +- qtmips_gui/coreview/multiplexer.cpp | 2 +- qtmips_gui/coreview/programcounter.cpp | 2 +- qtmips_gui/mainwindow.cpp | 2 +- qtmips_gui/registersdock.cpp | 4 +++- 10 files changed, 14 insertions(+), 12 deletions(-) diff --git a/build.sh b/build.sh index ec7109d..a76e870 100755 --- a/build.sh +++ b/build.sh @@ -8,7 +8,7 @@ cd build # Compile qtchooser -run-tool=qmake -qt=5 "$ROOT" "QMAKE_RPATHDIR += ../qtmips_machine" -make +make sub-qtmips_cli sub-qtmips_gui # Note: we are building these to to not build tests # Link executables to more suitable place ln -fs qtmips_cli/qtmips_cli cli diff --git a/qtmips_gui/coreview.cpp b/qtmips_gui/coreview.cpp index f7cc416..1750cc1 100644 --- a/qtmips_gui/coreview.cpp +++ b/qtmips_gui/coreview.cpp @@ -9,7 +9,7 @@ CoreView::CoreView(QWidget *parent) : QGraphicsView(parent) { //fitInView(0, 0, 201, 201, Qt::KeepAspectRatioByExpanding); } -void CoreView::resizeEvent(QResizeEvent *event) { +void CoreView::resizeEvent(QResizeEvent *event __attribute__((unused))) { // fitInView(0, 0, 201, 201, Qt::KeepAspectRatioByExpanding); } diff --git a/qtmips_gui/coreview/alu.cpp b/qtmips_gui/coreview/alu.cpp index 76cf8ad..bb48c7e 100644 --- a/qtmips_gui/coreview/alu.cpp +++ b/qtmips_gui/coreview/alu.cpp @@ -23,7 +23,7 @@ QRectF coreview::Alu::boundingRect() const { return QRectF(-PENW / 2, -PENW / 2, WIDTH + PENW, HEIGHT + PENW); } -void coreview::Alu::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { +void coreview::Alu::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) { const QPointF poly[] = { QPointF(0, 0), QPointF(WIDTH, WIDTH), diff --git a/qtmips_gui/coreview/connection.cpp b/qtmips_gui/coreview/connection.cpp index ebca519..f2b730c 100644 --- a/qtmips_gui/coreview/connection.cpp +++ b/qtmips_gui/coreview/connection.cpp @@ -58,13 +58,13 @@ QRectF Connection::boundingRect() const { if (y > points[i+1].y()) y = points[i+1].y(); // TODO pen width - rect.united(QRectF(x - 0.5, y - 0.5, fabs(points[i].x() - points[i+1].x()) + 1, fabs(points[i].y() - points[i+1].y()) + 1)); + rect = rect.united(QRectF(x - 0.5, y - 0.5, fabs(points[i].x() - points[i+1].x()) + 1, fabs(points[i].y() - points[i+1].y()) + 1)); } //return rect; return QRectF(0, 0, 300, 300); } -void Connection::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { +void Connection::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) { for (int i = 0; i < (points.size() - 1); i++) painter->drawLine(points[i], points[i+1]); // TODO meaby use QPath instead? diff --git a/qtmips_gui/coreview/latch.cpp b/qtmips_gui/coreview/latch.cpp index 0ad827a..5f2727b 100644 --- a/qtmips_gui/coreview/latch.cpp +++ b/qtmips_gui/coreview/latch.cpp @@ -16,7 +16,7 @@ QRectF Latch::boundingRect() const { return QRectF(-PENW / 2, -PENW / 2, WIDTH + PENW, height + PENW); } -void Latch::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { +void Latch::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) { painter->drawRect(0, 0, WIDTH, height); // Now tick rectangle const QPointF tickPolygon[] = { @@ -29,7 +29,7 @@ void Latch::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWi void Latch::setPos(qreal x, qreal y) { QGraphicsObject::setPos(x, y); - for (unsigned i = 0; i < connectors.size(); i++) { + for (int i = 0; i < connectors.size(); i++) { connectors[i].in->setPos(x, y + connectors_off[i]); connectors[i].out->setPos(x + WIDTH, y + connectors_off[i]); } diff --git a/qtmips_gui/coreview/memory.cpp b/qtmips_gui/coreview/memory.cpp index e6044fe..c732687 100644 --- a/qtmips_gui/coreview/memory.cpp +++ b/qtmips_gui/coreview/memory.cpp @@ -25,7 +25,7 @@ QRectF Memory::boundingRect() const { // TODO } -void Memory::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { +void Memory::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) { // TODO } diff --git a/qtmips_gui/coreview/multiplexer.cpp b/qtmips_gui/coreview/multiplexer.cpp index 148c58d..6f6abe1 100644 --- a/qtmips_gui/coreview/multiplexer.cpp +++ b/qtmips_gui/coreview/multiplexer.cpp @@ -32,7 +32,7 @@ QRectF Multiplexer::boundingRect() const { return QRectF(-PENW / 2, -PENW / 2, WIDTH + PENW, (HEIGHT * size) + PENW); } -void Multiplexer::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { +void Multiplexer::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) { const QPointF poly[] = { QPointF(0, 0), QPointF(WIDTH, WIDTH), diff --git a/qtmips_gui/coreview/programcounter.cpp b/qtmips_gui/coreview/programcounter.cpp index b25cbbe..a6565c7 100644 --- a/qtmips_gui/coreview/programcounter.cpp +++ b/qtmips_gui/coreview/programcounter.cpp @@ -25,7 +25,7 @@ QRectF ProgramCounter::boundingRect() const { return QRectF(-PENW / 2, -PENW / 2, WIDTH + PENW, HEIGHT + PENW); } -void ProgramCounter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { +void ProgramCounter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) { painter->drawRect(0, 0, WIDTH, HEIGHT); } diff --git a/qtmips_gui/mainwindow.cpp b/qtmips_gui/mainwindow.cpp index 92d1a74..6b8d19b 100644 --- a/qtmips_gui/mainwindow.cpp +++ b/qtmips_gui/mainwindow.cpp @@ -134,7 +134,7 @@ void MainWindow::set_speed() { machine->set_speed(0); } -void MainWindow::closeEvent(QCloseEvent *event) { +void MainWindow::closeEvent(QCloseEvent *event __attribute__((unused))) { settings->setValue("windowGeometry", saveGeometry()); settings->setValue("windowState", saveState()); settings->sync(); diff --git a/qtmips_gui/registersdock.cpp b/qtmips_gui/registersdock.cpp index 12690e2..8250321 100644 --- a/qtmips_gui/registersdock.cpp +++ b/qtmips_gui/registersdock.cpp @@ -27,7 +27,9 @@ RegistersDock::RegistersDock(QWidget *parent) : QDockWidget(parent) { } RegistersDock::~RegistersDock() { - delete pc, hi, lo; + delete pc; + delete hi; + delete lo; for (int i = 0; i < 32; i++) delete gp[i]; delete layout; -- cgit v1.2.3