fix compiler warnings

Mon, 04 Jun 2018 23:22:52 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Mon, 04 Jun 2018 23:22:52 +0300
changeset 1392
0541d9b21968
parent 1391
5fa4bf1fc781
child 1393
f0fe7ea82b81

fix compiler warnings

CMakeLists.txt file | annotate | diff | comparison | revisions
src/canvas.cpp file | annotate | diff | comparison | revisions
src/dialogs/configdialog.cpp file | annotate | diff | comparison | revisions
src/dialogs/subfilereferenceeditor.cpp file | annotate | diff | comparison | revisions
src/editmodes/circleMode.cpp file | annotate | diff | comparison | revisions
src/editmodes/rectangleMode.cpp file | annotate | diff | comparison | revisions
src/glcompiler.cpp file | annotate | diff | comparison | revisions
src/glcompiler.h file | annotate | diff | comparison | revisions
src/widgets/vertexobjecteditor.cpp file | annotate | diff | comparison | revisions
--- a/CMakeLists.txt	Mon Jun 04 23:12:40 2018 +0300
+++ b/CMakeLists.txt	Mon Jun 04 23:22:52 2018 +0300
@@ -30,6 +30,7 @@
 include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
 
 set_source_files_properties (${CMAKE_BINARY_DIR}/configuration.cpp PROPERTIES GENERATED TRUE)
+set_property(SOURCE configuration.cpp PROPERTY SKIP_AUTOMOC ON)
 
 set (LDFORGE_SOURCES
 	src/basics.cpp
@@ -239,7 +240,8 @@
 	if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
 		set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG")
 	endif()
-	set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -Wpedantic -Werror=switch")
+	set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=all -Wextra")
+	set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-implicit-fallthrough")
 endif()
 
 qt5_add_resources (LDFORGE_QRC ${LDFORGE_RESOURCES})
--- a/src/canvas.cpp	Mon Jun 04 23:12:40 2018 +0300
+++ b/src/canvas.cpp	Mon Jun 04 23:22:52 2018 +0300
@@ -236,7 +236,7 @@
 		event->accept();
 }
 
-void Canvas::dropEvent(QDropEvent* event)
+void Canvas::dropEvent(QDropEvent* /*event*/)
 {
 	/*
 	if (m_window and event->source() == m_window->getPrimitivesTree())
@@ -364,7 +364,7 @@
 	m_window->spawnContextMenu(event->globalPos());
 }
 
-void Canvas::dragEnterEvent(QDragEnterEvent* event)
+void Canvas::dragEnterEvent(QDragEnterEvent* /*event*/)
 {
 	/*
 	if (m_window and event->source() == m_window->getPrimitivesTree() and m_window->getPrimitivesTree()->currentItem())
--- a/src/dialogs/configdialog.cpp	Mon Jun 04 23:12:40 2018 +0300
+++ b/src/dialogs/configdialog.cpp	Mon Jun 04 23:22:52 2018 +0300
@@ -74,8 +74,8 @@
 	QDialog (parent, f),
 	HierarchyElement (parent),
 	ui (*new Ui_ConfigDialog),
-	libraries {config::libraries()},
-	librariesModel {new LibrariesModel {this->libraries, this}}
+	librariesModel {new LibrariesModel {this->libraries, this}},
+	libraries {config::libraries()}
 {
 	ui.setupUi (this);
 	ui.librariesView->setModel(this->librariesModel);
--- a/src/dialogs/subfilereferenceeditor.cpp	Mon Jun 04 23:12:40 2018 +0300
+++ b/src/dialogs/subfilereferenceeditor.cpp	Mon Jun 04 23:22:52 2018 +0300
@@ -25,8 +25,8 @@
 
 SubfileReferenceEditor::SubfileReferenceEditor(LDSubfileReference* reference, QWidget* parent) :
 	QDialog {parent},
-	reference {reference},
-	ui {*new Ui::SubfileReferenceEditor}
+	ui {*new Ui::SubfileReferenceEditor},
+	reference {reference}
 {
 	this->ui.setupUi(this);
 	this->ui.referenceName->setText(reference->referenceName());
--- a/src/editmodes/circleMode.cpp	Mon Jun 04 23:12:40 2018 +0300
+++ b/src/editmodes/circleMode.cpp	Mon Jun 04 23:22:52 2018 +0300
@@ -60,6 +60,7 @@
 	return 0.0;
 }
 
+#if 0
 static Matrix shearMatrixForPlane(Canvas* renderer)
 {
 	const Plane& plane = renderer->drawPlane();
@@ -82,6 +83,7 @@
 
 	return shearMatrix;
 }
+#endif
 
 void CircleMode::endDraw()
 {
@@ -137,9 +139,8 @@
 	else
 	{
 		// Ring finder failed, last resort: draw the ring with quads
-		Axis localx, localy, localz;
+		Axis localx, localy;
 		renderer()->getRelativeAxes (localx, localy);
-		localz = (Axis) (3 - localx - localy);
 		double x0 = m_drawedVerts[0][localx];
 		double y0 = m_drawedVerts[0][localy];
 
--- a/src/editmodes/rectangleMode.cpp	Mon Jun 04 23:12:40 2018 +0300
+++ b/src/editmodes/rectangleMode.cpp	Mon Jun 04 23:22:52 2018 +0300
@@ -75,9 +75,8 @@
 	Vertex v0 = m_drawedVerts[0],
 		   v1 = (countof(m_drawedVerts) >= 2) ? m_drawedVerts[1] : renderer()->position3D();
 
-	Axis localx, localy, localz;
+	Axis localx, localy;
 	renderer()->getRelativeAxes(localx, localy);
-	localz = renderer()->getRelativeZ();
 	m_rectangleVerts[0].setCoordinate(localx, v0[localx]);
 	m_rectangleVerts[0].setCoordinate(localy, v0[localy]);
 	m_rectangleVerts[1].setCoordinate(localx, v1[localx]);
--- a/src/glcompiler.cpp	Mon Jun 04 23:12:40 2018 +0300
+++ b/src/glcompiler.cpp	Mon Jun 04 23:22:52 2018 +0300
@@ -26,7 +26,7 @@
 #include "algorithms/invert.h"
 #include "generics/ring.h"
 
-void checkGLError(HierarchyElement* element, QString file, int line)
+void checkGLError(QString file, int line)
 {
 	struct ErrorInfo
 	{
--- a/src/glcompiler.h	Mon Jun 04 23:12:40 2018 +0300
+++ b/src/glcompiler.h	Mon Jun 04 23:22:52 2018 +0300
@@ -96,5 +96,5 @@
 	void clearSelectionModel();
 };
 
-#define CHECK_GL_ERROR() { checkGLError(this, __FILE__, __LINE__); }
-void checkGLError (HierarchyElement* element, QString file, int line);
+#define CHECK_GL_ERROR() { checkGLError(__FILE__, __LINE__); }
+void checkGLError (QString file, int line);
--- a/src/widgets/vertexobjecteditor.cpp	Mon Jun 04 23:12:40 2018 +0300
+++ b/src/widgets/vertexobjecteditor.cpp	Mon Jun 04 23:22:52 2018 +0300
@@ -25,9 +25,9 @@
 
 VertexObjectEditor::VertexObjectEditor(LDObject* object, QWidget *parent) :
 	QDialog {parent},
-	object {object},
 	ui {*new Ui_VertexObjectEditor},
-	vertexGrid {new QGridLayout}
+	vertexGrid {new QGridLayout},
+	object {object}
 {
 	this->ui.setupUi(this);
 	this->ui.verticesContainer->setLayout(this->vertexGrid);

mercurial