Fix warnings and build issues

This commit is contained in:
Ivan 2024-07-14 13:44:57 +03:00
parent 0c6d998cc5
commit cc5a605a88
10 changed files with 24 additions and 13 deletions

View File

@ -7,7 +7,7 @@ LABEL description="Linux build environment"
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
# Install standard packages # Install standard packages
RUN dnf update && \ RUN dnf update -y && \
dnf upgrade -y && \ dnf upgrade -y && \
dnf install -y \ dnf install -y \
nano \ nano \

View File

@ -44,7 +44,7 @@ public:
template<typename Up, template<typename Up,
typename std::enable_if_t<std::is_constructible_v<T, Up&&>>> typename std::enable_if_t<std::is_constructible_v<T, Up&&>>>
PropagateConst(PropagateConst<Up>&& up) // NOLINT(google-explicit-constructor, hicpp-explicit-conversions) PropagateConst(PropagateConst<Up>&& up) // NOLINT(google-explicit-constructor, hicpp-explicit-conversions)
: pointer{ std::move(up.pointer) } {} : pointer{ std::move(up).pointer } {}
template<typename Up, template<typename Up,
typename std::enable_if_t<std::is_constructible_v<T, Up&&>>> typename std::enable_if_t<std::is_constructible_v<T, Up&&>>>
@ -56,7 +56,7 @@ public:
template<typename Up, template<typename Up,
typename std::enable_if_t<std::is_constructible_v<T, Up&&>>> typename std::enable_if_t<std::is_constructible_v<T, Up&&>>>
constexpr PropagateConst& operator=(PropagateConst<Up>&& up) { constexpr PropagateConst& operator=(PropagateConst<Up>&& up) {
pointer = std::move(up.pointer); pointer = std::move(up).pointer;
return *this; return *this;
} }

View File

@ -26,8 +26,11 @@ struct StaticMap {
[[nodiscard]] constexpr bool ContainsKey(const Key& key) const noexcept { [[nodiscard]] constexpr bool ContainsKey(const Key& key) const noexcept {
const auto itr = const auto itr =
std::find_if(begin(data), end(data), std::find_if(
[&key](const auto& v) { return v.first == key; }); begin(data),
end(data),
[&key](const auto& v) { return v.first == key; }
);
if (itr != end(data)) { if (itr != end(data)) {
return true; return true;
} else { } else {
@ -37,8 +40,11 @@ struct StaticMap {
[[nodiscard]] constexpr bool ContainsValue(const Value& value) const noexcept { [[nodiscard]] constexpr bool ContainsValue(const Value& value) const noexcept {
const auto itr = const auto itr =
std::find_if(begin(data), end(data), std::find_if(
[&value](const auto& v) { return v.second == value; }); begin(data),
end(data),
[&value](const auto& v) { return v.second == value; }
);
if (itr != end(data)) { if (itr != end(data)) {
return true; return true;
} else { } else {

View File

@ -625,8 +625,9 @@ bool ASTInterpreter::EvaluateFilterComplex(
auto result = Factory::EmptySet(); auto result = Factory::EmptySet();
for (const auto& element : argument.B()) { for (const auto& element : argument.B()) {
std::vector<StructuredData> components{}; std::vector<StructuredData> components{};
for (auto i = 0U; i < size(indicies); ++i) { components.reserve(size(indicies));
components.emplace_back(element.T().Component(indicies[i])); for (const auto& index : indicies) {
components.emplace_back(element.T().Component(index));
} }
const auto tuple = Factory::Tuple(components); const auto tuple = Factory::Tuple(components);
if (paramValue.B().Contains(tuple)) { if (paramValue.B().Contains(tuple)) {

View File

@ -24,6 +24,7 @@
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuseless-cast" #pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable" #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#endif #endif
#include "AsciiLexerImpl.hpp" #include "AsciiLexerImpl.hpp"

View File

@ -24,6 +24,7 @@
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuseless-cast" #pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable" #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#endif #endif
#include "MathLexerImpl.hpp" #include "MathLexerImpl.hpp"

View File

@ -191,7 +191,7 @@ RawNode TupleDeclaration(ParserState* state, RawNode tuple) {
// TODO: check tuple contains only local variables, ParseEID::expectedLocal // TODO: check tuple contains only local variables, ParseEID::expectedLocal
std::vector<Node*> stack{ tuple.get()}; std::vector<Node*> stack{ tuple.get()};
while (!stack.empty()) { while (!stack.empty()) {
auto node = stack.back(); auto* node = stack.back();
const auto id = node->token.id; const auto id = node->token.id;
stack.pop_back(); stack.pop_back();
if (id == TokenID::NT_TUPLE) { if (id == TokenID::NT_TUPLE) {
@ -257,9 +257,9 @@ bool SemanticCheck(ParserState* state, RawNode root) {
std::vector<Node*> stack{ root.get() }; std::vector<Node*> stack{ root.get() };
std::vector<Node*> parents{ nullptr }; std::vector<Node*> parents{ nullptr };
while (!stack.empty()) { while (!stack.empty()) {
const auto node = stack.back(); auto *const node = stack.back();
stack.pop_back(); stack.pop_back();
const auto parent = parents.back(); auto *const parent = parents.back();
parents.pop_back(); parents.pop_back();
const auto id = node->token.id; const auto id = node->token.id;

View File

@ -986,7 +986,7 @@ bool TypeAuditor::ViFilter(Cursor iter) {
); );
return false; return false;
} }
++child; ++child; // NOLINT(clang-diagnostic-for-loop-analysis)
} }
} else { } else {
const auto param = ChildType(iter, 0); const auto param = ChildType(iter, 0);

View File

@ -23,6 +23,7 @@
#if defined(__GNUC__) && !defined(__clang__) #if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuseless-cast" #pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#endif #endif
#include "../lib/convert.cpp" #include "../lib/convert.cpp"

View File

@ -25,6 +25,7 @@
#pragma GCC diagnostic ignored "-Wuseless-cast" #pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wunused-label" #pragma GCC diagnostic ignored "-Wunused-label"
#pragma GCC diagnostic ignored "-Warray-bounds" #pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#endif #endif
#include "../lib/debug.cpp" #include "../lib/debug.cpp"