From fb877e1304d0de87e77c7761ff9b71b1df109088 Mon Sep 17 00:00:00 2001 From: Andreas Stallinger Date: Tue, 18 Aug 2015 14:43:32 +0200 Subject: [PATCH] build: fix compiler and cmake warnings added missing virtual destructor fixed a warning in token.h: expression with side effects will be evaluated despite being used as an operand to 'typeid' CMP00043 Cmake warning added missing override keyword --- CMakeLists.txt | 25 ++++++++++++++++----- cmake/version.cmake | 2 +- script/git-sync-master.sh | 2 +- src/app/qt/element/QtProjectSetupScreen.h | 2 +- src/app/qt/element/QtSettingsWindow.h | 4 ++-- src/app/qt/element/QtStartScreen.h | 2 +- src/app/qt/view/QtGraphViewStyleImpl.cpp | 4 ++++ src/app/qt/view/QtGraphViewStyleImpl.h | 1 + src/lib/component/view/GraphViewStyleImpl.h | 1 + src/lib/data/graph/Token.h | 6 +++-- src/lib/utility/file/FileManager.h | 2 +- 11 files changed, 36 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20c8d858..f86d5f48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,10 @@ cmake_minimum_required(VERSION 2.8.9) +# to get CMP0043 warnings, upgrade to version 3 and change the line above to VERSION 3.0 and remove the line below +if(POLICY CMP0043) + cmake_policy(SET CMP0043 OLD) +endif() + include(cmake/add_files.cmake) include(cmake/create_source_groups.cmake) include(cmake/version_setup.cmake) @@ -90,12 +95,17 @@ set_property( PROPERTY INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/src/lib" "${CMAKE_SOURCE_DIR}/src/external" - ${LLVM_INCLUDE_DIRS} - ${CLANG_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} - ${EIGEN_ROOT} + ) +target_include_directories(${LIB_PROJECT_NAME} SYSTEM + PUBLIC ${LLVM_INCLUDE_DIRS} + ${CLANG_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ${EIGEN_ROOT} +) + + link_directories(${LLVM_LIBRARY_DIRS} ${CLANG_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS}) target_link_libraries(${LIB_PROJECT_NAME} ${CLANG_LIBRARIES} ${LLVM_AVAILABLE_LIBS} ${Boost_LIBRARIES}) @@ -171,8 +181,11 @@ set_property( "${CMAKE_SOURCE_DIR}/src/lib" "${CMAKE_SOURCE_DIR}/src/app" "${CMAKE_SOURCE_DIR}/build/src/app" - "${CMAKE_SOURCE_DIR}/src/external" - ${Boost_INCLUDE_DIRS} +) + +target_include_directories(${APP_PROJECT_NAME} SYSTEM + PUBLIC "${CMAKE_SOURCE_DIR}/src/external" + PUBLIC ${Boost_INCLUDE_DIRS} ) # Use the Widgets module from Qt 5. diff --git a/cmake/version.cmake b/cmake/version.cmake index f13e93dd..b0f29c6d 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -23,7 +23,7 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/.git") ) execute_process( - COMMAND git describe --match "[0-9]*" --abbrev=7 HEAD + COMMAND git describe --long --match "[0-9]*" --abbrev=7 HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_VERSION_NUMBER OUTPUT_STRIP_TRAILING_WHITESPACE diff --git a/script/git-sync-master.sh b/script/git-sync-master.sh index e6aaaaee..9aaecd9a 100755 --- a/script/git-sync-master.sh +++ b/script/git-sync-master.sh @@ -40,7 +40,7 @@ fi # fetch remote changes echo -e $INFO "Fetching changes" -git fetch origin master +git fetch origin master --tags if [ $? != 0 ] then diff --git a/src/app/qt/element/QtProjectSetupScreen.h b/src/app/qt/element/QtProjectSetupScreen.h index 47428ee2..bd3b2472 100644 --- a/src/app/qt/element/QtProjectSetupScreen.h +++ b/src/app/qt/element/QtProjectSetupScreen.h @@ -31,7 +31,7 @@ Q_OBJECT public: QtProjectSetupScreen(QWidget* parent = 0); QSize sizeHint() const Q_DECL_OVERRIDE; - virtual void setup(); + virtual void setup() override; private slots: void handleCreateButtonPress(); void handleCancelButtonPress(); diff --git a/src/app/qt/element/QtSettingsWindow.h b/src/app/qt/element/QtSettingsWindow.h index 89f79b34..642858ee 100644 --- a/src/app/qt/element/QtSettingsWindow.h +++ b/src/app/qt/element/QtSettingsWindow.h @@ -16,8 +16,8 @@ public: protected: QWidget* m_window; - void keyPressEvent(QKeyEvent* event); - void resizeEvent(QResizeEvent* event); + void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE; + void resizeEvent(QResizeEvent* event) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; diff --git a/src/app/qt/element/QtStartScreen.h b/src/app/qt/element/QtStartScreen.h index 3a2e1d8e..8983717a 100644 --- a/src/app/qt/element/QtStartScreen.h +++ b/src/app/qt/element/QtStartScreen.h @@ -22,7 +22,7 @@ class QtStartScreen : public QtSettingsWindow public: QtStartScreen(QWidget* parent = 0); QSize sizeHint() const Q_DECL_OVERRIDE; - virtual void setup(); + virtual void setup() override; signals: void openOpenProjectDialog(); diff --git a/src/app/qt/view/QtGraphViewStyleImpl.cpp b/src/app/qt/view/QtGraphViewStyleImpl.cpp index 22c65b0e..016a76b5 100644 --- a/src/app/qt/view/QtGraphViewStyleImpl.cpp +++ b/src/app/qt/view/QtGraphViewStyleImpl.cpp @@ -2,6 +2,10 @@ #include +QtGraphViewStyleImpl::~QtGraphViewStyleImpl() +{ +} + float QtGraphViewStyleImpl::getCharWidthForNodeType(Node::NodeType type) { return QFontMetrics(QtGraphNode::getFontForNodeType(type)).width("QtGraphNode::QtGraphNode::QtGraphNode") / 37.0f; diff --git a/src/app/qt/view/QtGraphViewStyleImpl.h b/src/app/qt/view/QtGraphViewStyleImpl.h index 67140985..8ea76ae7 100644 --- a/src/app/qt/view/QtGraphViewStyleImpl.h +++ b/src/app/qt/view/QtGraphViewStyleImpl.h @@ -8,6 +8,7 @@ class QtGraphViewStyleImpl : public GraphViewStyleImpl { public: + virtual ~QtGraphViewStyleImpl(); virtual float getCharWidthForNodeType(Node::NodeType type); virtual float getCharHeightForNodeType(Node::NodeType type); }; diff --git a/src/lib/component/view/GraphViewStyleImpl.h b/src/lib/component/view/GraphViewStyleImpl.h index c343e30f..a38b7930 100644 --- a/src/lib/component/view/GraphViewStyleImpl.h +++ b/src/lib/component/view/GraphViewStyleImpl.h @@ -6,6 +6,7 @@ class GraphViewStyleImpl { public: + virtual ~GraphViewStyleImpl() { } virtual float getCharWidthForNodeType(Node::NodeType type) = 0; virtual float getCharHeightForNodeType(Node::NodeType type) = 0; }; diff --git a/src/lib/data/graph/Token.h b/src/lib/data/graph/Token.h index 309333bd..6f342a18 100644 --- a/src/lib/data/graph/Token.h +++ b/src/lib/data/graph/Token.h @@ -56,7 +56,8 @@ ComponentType* Token::getComponent() const { for (std::shared_ptr component: m_components) { - if (typeid(ComponentType) == typeid(*(component.get()))) + TokenComponent* componentPtr = component.get(); + if (typeid(ComponentType) == typeid(*componentPtr)) { return dynamic_cast(component.get()); } @@ -70,7 +71,8 @@ std::shared_ptr Token::removeComponent() for (size_t i = 0; i < m_components.size(); i++) { std::shared_ptr component = m_components[i]; - if (typeid(ComponentType) == typeid(*(component.get()))) + TokenComponent* componentPtr = component.get(); + if (typeid(ComponentType) == typeid(*componentPtr)) { m_components.erase(m_components.begin() + i); return std::dynamic_pointer_cast(component); diff --git a/src/lib/utility/file/FileManager.h b/src/lib/utility/file/FileManager.h index 867d58a9..f96002a9 100644 --- a/src/lib/utility/file/FileManager.h +++ b/src/lib/utility/file/FileManager.h @@ -11,7 +11,7 @@ class FileManager { public: FileManager(); - ~FileManager(); + virtual ~FileManager(); const std::vector& getSourcePaths() const; const std::vector& getIncludePaths() const;