From 0230e2d0251cac687db632e5e3ea5bdbf29c1203 Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Mon, 30 Aug 2021 10:14:27 +0200 Subject: [PATCH] BUILD: Fix some gcc's warnings - Disable the subobject linkage warning for gcc. - Solves one shadowing pb - Delete unused DataPtr --- CMakeLists.txt | 8 +++++++- src/Lib/AbstractMediaContext.hh | 1 - src/Lib/Ass/Style.cc | 14 +++++++------- src/Lib/Audio.hh | 5 ----- src/Lib/Document/VivyDocument.cc | 6 +++--- src/Lib/Script/CRTPLuaScriptObject.hh | 6 +----- src/UI/MainWindow.cc | 2 +- src/UI/ScriptViews/ScriptHighlighter.cc | 2 +- 8 files changed, 20 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5aff844f..edb6c4f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,7 +129,13 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") -fopenmp ) elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") - target_compile_options(Vivy PRIVATE -fopenmp) + target_compile_options(Vivy PRIVATE + -fopenmp + -Wno-subobject-linkage # Kubat: Some proglems here, it seems they + # occure because of the usage of "using" for + # type aliasing... As I won't get ride of the + # "using"s the warning is disabled + ) endif() set_target_properties(Vivy PROPERTIES diff --git a/src/Lib/AbstractMediaContext.hh b/src/Lib/AbstractMediaContext.hh index 1e113c45..f4a09ed6 100644 --- a/src/Lib/AbstractMediaContext.hh +++ b/src/Lib/AbstractMediaContext.hh @@ -42,7 +42,6 @@ static inline constexpr auto avFormatContextDeleter = [](AVFormatContext *ptr) n using AVFormatContextPtr = std::unique_ptr<AVFormatContext, decltype(avFormatContextDeleter)>; using AVCodecContextPtr = std::unique_ptr<AVCodecContext, decltype(codecContexteleter)>; -using DataPtr = std::shared_ptr<double[]>; using AVFramePtr = std::unique_ptr<AVFrame, decltype(avFrameDeleter)>; using SwrContextPtr = std::unique_ptr<SwrContext, decltype(swrContenxtDeleter)>; diff --git a/src/Lib/Ass/Style.cc b/src/Lib/Ass/Style.cc index 73afcbb1..1a6ce05c 100644 --- a/src/Lib/Ass/Style.cc +++ b/src/Lib/Ass/Style.cc @@ -176,13 +176,13 @@ Style::getProperties() const noexcept }; QJsonObject styleFontProperties{ - { "Scale X", static_cast<const double>(scaleX) }, - { "Scale Y", static_cast<const double>(scaleY) }, - { "Spacing", static_cast<const double>(spacing) }, - { "Angle", static_cast<const double>(angle) }, - { "Border Style", static_cast<const double>(borderStyle) }, - { "Outline", static_cast<const double>(outline) }, - { "Shadow", static_cast<const double>(shadow) }, + { "Scale X", static_cast<double>(scaleX) }, + { "Scale Y", static_cast<double>(scaleY) }, + { "Spacing", static_cast<double>(spacing) }, + { "Angle", static_cast<double>(angle) }, + { "Border Style", static_cast<double>(borderStyle) }, + { "Outline", static_cast<double>(outline) }, + { "Shadow", static_cast<double>(shadow) }, }; QJsonObject styleMargins{ diff --git a/src/Lib/Audio.hh b/src/Lib/Audio.hh index 36cc5519..920b1033 100644 --- a/src/Lib/Audio.hh +++ b/src/Lib/Audio.hh @@ -65,10 +65,5 @@ public: QString getElementName() const noexcept override; QJsonDocument getProperties() const noexcept override; - -private: - // Regarding the format - using AVFormatContextPtr = std::unique_ptr<AVFormatContext, decltype(avFormatContextDeleter)>; - AVFormatContextPtr format{ avformat_alloc_context(), avFormatContextDeleter }; }; } diff --git a/src/Lib/Document/VivyDocument.cc b/src/Lib/Document/VivyDocument.cc index 5a6dacc5..01f15771 100644 --- a/src/Lib/Document/VivyDocument.cc +++ b/src/Lib/Document/VivyDocument.cc @@ -339,7 +339,7 @@ VivyDocument::setAudioSubDocument(const QString filename) noexcept QFileInfo fileInfo(filename); const QString baseName = fileInfo.baseName(); - if (auto doc = audioDocument.get()) { + if ([[maybe_unused]] auto doc = audioDocument.get()) { // Here we may want to do some confirmation / cleanup audioDocument.reset(); } @@ -356,7 +356,7 @@ VivyDocument::setVideoSubDocument(const QString filename) noexcept QFileInfo fileInfo(filename); const QString baseName = fileInfo.baseName(); - if (auto doc = videoDocument.get()) { + if ([[maybe_unused]] auto doc = videoDocument.get()) { // Here we may want to do some confirmation / cleanup videoDocument.reset(); } @@ -373,7 +373,7 @@ VivyDocument::setAssSubDocument(const QString filename) noexcept QFileInfo fileInfo(filename); const QString baseName = fileInfo.baseName(); - if (auto doc = assDocument.get()) { + if ([[maybe_unused]] auto doc = assDocument.get()) { // Here we may want to do some confirmation / cleanup assDocument.reset(); } diff --git a/src/Lib/Script/CRTPLuaScriptObject.hh b/src/Lib/Script/CRTPLuaScriptObject.hh index eed3eb57..3a5a51e7 100644 --- a/src/Lib/Script/CRTPLuaScriptObject.hh +++ b/src/Lib/Script/CRTPLuaScriptObject.hh @@ -70,11 +70,7 @@ protected: { luaL_checktype(L, tblIndex, LUA_TTABLE); const std::size_t count = lua_rawlen(L, tblIndex); - if (count >= std::numeric_limits<int>::max()) - luaL_error(L, "To many items (%lu) in table to iterate over!", count); - - const int countInt = static_cast<const int>(count); - for (int i = 1; i <= countInt; ++i) { + for (int i = 1; std::cmp_less(i, count); ++i) { luaL_checktype(L, tblIndex, LUA_TTABLE); lua_pushinteger(L, i); // i -> top stack lua_gettable(L, tblIndex); // T[i] -> top stack and pop i diff --git a/src/UI/MainWindow.cc b/src/UI/MainWindow.cc index f4f1d71f..01ebb7bc 100644 --- a/src/UI/MainWindow.cc +++ b/src/UI/MainWindow.cc @@ -175,7 +175,7 @@ MainWindow::updateFakeVimUsage(bool yes) noexcept documentExists && (docView->getDocument()->getType() == AbstractDocument::Type::Script); if (isScriptEditor) - static_cast<ScriptDocumentView *const>(docView)->setUseFakeVimEditor(yes); + static_cast<ScriptDocumentView *>(docView)->setUseFakeVimEditor(yes); } } diff --git a/src/UI/ScriptViews/ScriptHighlighter.cc b/src/UI/ScriptViews/ScriptHighlighter.cc index 564ea25a..2baf555a 100644 --- a/src/UI/ScriptViews/ScriptHighlighter.cc +++ b/src/UI/ScriptViews/ScriptHighlighter.cc @@ -100,7 +100,7 @@ ScriptHighlighter::previousBlockState() noexcept state != Utils::toUnderlying(BlockState::Comment)) return BlockState::None; - return static_cast<const BlockState>(state); + return static_cast<BlockState>(state); } void -- GitLab