From cc5a605a88081c76a558a2b86c0445ef298af429 Mon Sep 17 00:00:00 2001 From: Ivan <8611739+IRBorisov@users.noreply.github.com> Date: Sun, 14 Jul 2024 13:44:57 +0300 Subject: [PATCH] Fix warnings and build issues --- Dockerfile | 2 +- ccl/cclCommons/include/ccl/cclMeta.hpp | 4 ++-- ccl/cclCommons/include/ccl/cclTypes.hpp | 14 ++++++++++---- ccl/rslang/src/ASTInterpreter.cpp | 5 +++-- ccl/rslang/src/AsciiLexer.cpp | 1 + ccl/rslang/src/MathLexer.cpp | 1 + ccl/rslang/src/RSParser.cpp | 6 +++--- ccl/rslang/src/TypeAuditor.cpp | 2 +- ccl/rslang/unity/reflex_unity1.cpp | 1 + ccl/rslang/unity/reflex_unity2.cpp | 1 + 10 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 043415c..75bdac2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ LABEL description="Linux build environment" ARG DEBIAN_FRONTEND=noninteractive # Install standard packages -RUN dnf update && \ +RUN dnf update -y && \ dnf upgrade -y && \ dnf install -y \ nano \ diff --git a/ccl/cclCommons/include/ccl/cclMeta.hpp b/ccl/cclCommons/include/ccl/cclMeta.hpp index 4218beb..7ed45ca 100644 --- a/ccl/cclCommons/include/ccl/cclMeta.hpp +++ b/ccl/cclCommons/include/ccl/cclMeta.hpp @@ -44,7 +44,7 @@ public: template>> PropagateConst(PropagateConst&& up) // NOLINT(google-explicit-constructor, hicpp-explicit-conversions) - : pointer{ std::move(up.pointer) } {} + : pointer{ std::move(up).pointer } {} template>> @@ -56,7 +56,7 @@ public: template>> constexpr PropagateConst& operator=(PropagateConst&& up) { - pointer = std::move(up.pointer); + pointer = std::move(up).pointer; return *this; } diff --git a/ccl/cclCommons/include/ccl/cclTypes.hpp b/ccl/cclCommons/include/ccl/cclTypes.hpp index 7afa9a0..c9eea8d 100644 --- a/ccl/cclCommons/include/ccl/cclTypes.hpp +++ b/ccl/cclCommons/include/ccl/cclTypes.hpp @@ -26,8 +26,11 @@ struct StaticMap { [[nodiscard]] constexpr bool ContainsKey(const Key& key) const noexcept { const auto itr = - std::find_if(begin(data), end(data), - [&key](const auto& v) { return v.first == key; }); + std::find_if( + begin(data), + end(data), + [&key](const auto& v) { return v.first == key; } + ); if (itr != end(data)) { return true; } else { @@ -37,8 +40,11 @@ struct StaticMap { [[nodiscard]] constexpr bool ContainsValue(const Value& value) const noexcept { const auto itr = - std::find_if(begin(data), end(data), - [&value](const auto& v) { return v.second == value; }); + std::find_if( + begin(data), + end(data), + [&value](const auto& v) { return v.second == value; } + ); if (itr != end(data)) { return true; } else { diff --git a/ccl/rslang/src/ASTInterpreter.cpp b/ccl/rslang/src/ASTInterpreter.cpp index fc3072e..9544590 100644 --- a/ccl/rslang/src/ASTInterpreter.cpp +++ b/ccl/rslang/src/ASTInterpreter.cpp @@ -625,8 +625,9 @@ bool ASTInterpreter::EvaluateFilterComplex( auto result = Factory::EmptySet(); for (const auto& element : argument.B()) { std::vector components{}; - for (auto i = 0U; i < size(indicies); ++i) { - components.emplace_back(element.T().Component(indicies[i])); + components.reserve(size(indicies)); + for (const auto& index : indicies) { + components.emplace_back(element.T().Component(index)); } const auto tuple = Factory::Tuple(components); if (paramValue.B().Contains(tuple)) { diff --git a/ccl/rslang/src/AsciiLexer.cpp b/ccl/rslang/src/AsciiLexer.cpp index 5567b70..36967f2 100644 --- a/ccl/rslang/src/AsciiLexer.cpp +++ b/ccl/rslang/src/AsciiLexer.cpp @@ -24,6 +24,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wuseless-cast" #pragma GCC diagnostic ignored "-Wunused-but-set-variable" + #pragma GCC diagnostic ignored "-Woverloaded-virtual" #endif #include "AsciiLexerImpl.hpp" diff --git a/ccl/rslang/src/MathLexer.cpp b/ccl/rslang/src/MathLexer.cpp index 3d7ba7d..605d09e 100644 --- a/ccl/rslang/src/MathLexer.cpp +++ b/ccl/rslang/src/MathLexer.cpp @@ -24,6 +24,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wuseless-cast" #pragma GCC diagnostic ignored "-Wunused-but-set-variable" + #pragma GCC diagnostic ignored "-Woverloaded-virtual" #endif #include "MathLexerImpl.hpp" diff --git a/ccl/rslang/src/RSParser.cpp b/ccl/rslang/src/RSParser.cpp index 08bf301..32c8a99 100644 --- a/ccl/rslang/src/RSParser.cpp +++ b/ccl/rslang/src/RSParser.cpp @@ -191,7 +191,7 @@ RawNode TupleDeclaration(ParserState* state, RawNode tuple) { // TODO: check tuple contains only local variables, ParseEID::expectedLocal std::vector stack{ tuple.get()}; while (!stack.empty()) { - auto node = stack.back(); + auto* node = stack.back(); const auto id = node->token.id; stack.pop_back(); if (id == TokenID::NT_TUPLE) { @@ -257,9 +257,9 @@ bool SemanticCheck(ParserState* state, RawNode root) { std::vector stack{ root.get() }; std::vector parents{ nullptr }; while (!stack.empty()) { - const auto node = stack.back(); + auto *const node = stack.back(); stack.pop_back(); - const auto parent = parents.back(); + auto *const parent = parents.back(); parents.pop_back(); const auto id = node->token.id; diff --git a/ccl/rslang/src/TypeAuditor.cpp b/ccl/rslang/src/TypeAuditor.cpp index 50e0184..a1386c3 100644 --- a/ccl/rslang/src/TypeAuditor.cpp +++ b/ccl/rslang/src/TypeAuditor.cpp @@ -986,7 +986,7 @@ bool TypeAuditor::ViFilter(Cursor iter) { ); return false; } - ++child; + ++child; // NOLINT(clang-diagnostic-for-loop-analysis) } } else { const auto param = ChildType(iter, 0); diff --git a/ccl/rslang/unity/reflex_unity1.cpp b/ccl/rslang/unity/reflex_unity1.cpp index 8c0a4b3..1d85e5b 100644 --- a/ccl/rslang/unity/reflex_unity1.cpp +++ b/ccl/rslang/unity/reflex_unity1.cpp @@ -23,6 +23,7 @@ #if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wuseless-cast" + #pragma GCC diagnostic ignored "-Woverloaded-virtual" #endif #include "../lib/convert.cpp" diff --git a/ccl/rslang/unity/reflex_unity2.cpp b/ccl/rslang/unity/reflex_unity2.cpp index c497dc9..af4d82a 100644 --- a/ccl/rslang/unity/reflex_unity2.cpp +++ b/ccl/rslang/unity/reflex_unity2.cpp @@ -25,6 +25,7 @@ #pragma GCC diagnostic ignored "-Wuseless-cast" #pragma GCC diagnostic ignored "-Wunused-label" #pragma GCC diagnostic ignored "-Warray-bounds" + #pragma GCC diagnostic ignored "-Woverloaded-virtual" #endif #include "../lib/debug.cpp"