From 96f034b2e3d3f7d1004d5a2d149198e05dd075d3 Mon Sep 17 00:00:00 2001 From: Marcos Bento Date: Tue, 26 Mar 2024 14:48:03 +0000 Subject: [PATCH 1/7] Suppress GCC 13 false positive warning on Cereal --- .../cereal/details/polymorphic_impl.hpp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/3rdparty/cereal/include/cereal/details/polymorphic_impl.hpp b/3rdparty/cereal/include/cereal/details/polymorphic_impl.hpp index bee13ab40..df510ffd6 100644 --- a/3rdparty/cereal/include/cereal/details/polymorphic_impl.hpp +++ b/3rdparty/cereal/include/cereal/details/polymorphic_impl.hpp @@ -186,7 +186,14 @@ namespace cereal template inline static const Derived * downcast( const void * dptr, std::type_info const & baseInfo ) { +#pragma GCC diagnostic push +#if defined(__GNUC__) && (__GNUC__ >= 13) +#pragma GCC diagnostic ignored "-Wdangling-reference" +#endif + // Without the warning suppression, the following source line generates a warning in GNU GCC 13.x + // The warning is a false positive, reported as a GCC compiler regression: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532 auto const & mapping = lookup( baseInfo, typeid(Derived), [&](){ UNREGISTERED_POLYMORPHIC_CAST_EXCEPTION(save) } ); +#pragma GCC diagnostic pop for( auto const * dmap : mapping ) dptr = dmap->downcast( dptr ); @@ -200,7 +207,15 @@ namespace cereal template inline static void * upcast( Derived * const dptr, std::type_info const & baseInfo ) { +#pragma GCC diagnostic push +#pragma GCC diagnostic push +#if defined(__GNUC__) && (__GNUC__ >= 13) + #pragma GCC diagnostic ignored "-Wdangling-reference" +#endif + // Without the warning suppression, the following source line generates a warning in GNU GCC 13.x + // The warning is a false positive, reported as a GCC compiler regression: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532 auto const & mapping = lookup( baseInfo, typeid(Derived), [&](){ UNREGISTERED_POLYMORPHIC_CAST_EXCEPTION(load) } ); +#pragma GCC diagnostic pop void * uptr = dptr; for( auto mIter = mapping.rbegin(), mEnd = mapping.rend(); mIter != mEnd; ++mIter ) @@ -213,7 +228,15 @@ namespace cereal template inline static std::shared_ptr upcast( std::shared_ptr const & dptr, std::type_info const & baseInfo ) { +#pragma GCC diagnostic push +#pragma GCC diagnostic push +#if defined(__GNUC__) && (__GNUC__ >= 13) + #pragma GCC diagnostic ignored "-Wdangling-reference" +#endif + // Without the warning suppression, the following source line generates a warning in GNU GCC 13.x + // The warning is a false positive, reported as a GCC compiler regression: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532 auto const & mapping = lookup( baseInfo, typeid(Derived), [&](){ UNREGISTERED_POLYMORPHIC_CAST_EXCEPTION(load) } ); +#pragma GCC diagnostic pop std::shared_ptr uptr = dptr; for( auto mIter = mapping.rbegin(), mEnd = mapping.rend(); mIter != mEnd; ++mIter ) From 0286a06a6aad7b1b63329447a3b4e0600b0b081a Mon Sep 17 00:00:00 2001 From: Marcos Bento Date: Tue, 26 Mar 2024 16:32:30 +0000 Subject: [PATCH 2/7] Silence compilation warning [-Wunused-but-set-variable] --- libs/core/src/ecflow/core/Chrono.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/core/src/ecflow/core/Chrono.cpp b/libs/core/src/ecflow/core/Chrono.cpp index 37c4641c1..cc90999e9 100644 --- a/libs/core/src/ecflow/core/Chrono.cpp +++ b/libs/core/src/ecflow/core/Chrono.cpp @@ -181,12 +181,12 @@ DurationOut parse_duration(const std::string& d) { // Extract tail std::string tail = d.substr(found + 1, std::string::npos); - // Important! - // The whole duration has the same sign as the first component - // e.g. -23:59:59, is interpreted as (-23 hours) + (-59 minutes) + (-59 seconds) = -86399 seconds - int sign = value >= FirstDuration{0} ? 1 : -1; - if constexpr (sizeof...(RestDurations) > 0) { + // Important! + // The whole duration has the same sign as the first component + // e.g. -23:59:59, is interpreted as (-23 hours) + (-59 minutes) + (-59 seconds) = -86399 seconds + int sign = value >= FirstDuration{0} ? 1 : -1; + out = out + (sign)*parse_duration(tail); } From 1f4bc917ea815704d699c662362560f746fabaea Mon Sep 17 00:00:00 2001 From: Marcos Bento Date: Tue, 26 Mar 2024 16:38:53 +0000 Subject: [PATCH 3/7] Silence compilation warning [-Wunused-variable] --- libs/rest/src/ecflow/http/ApiV1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/rest/src/ecflow/http/ApiV1.cpp b/libs/rest/src/ecflow/http/ApiV1.cpp index 49eb4e7aa..3f91a2809 100644 --- a/libs/rest/src/ecflow/http/ApiV1.cpp +++ b/libs/rest/src/ecflow/http/ApiV1.cpp @@ -176,7 +176,7 @@ ojson filter_json(const ojson& j, const httplib::Request& r) { // special case: filter is .[INDEX], means that we return the // correct array element from root json element assuming it's an array if (path_elems.size() == 1 && path_elems[0][0] == '[' && path_elems[0][path_elems[0].size() - 1] == ']') { - const auto [key, index] = get_array_info(path_elems[0]); + [[maybe_unused]] const auto [key, index] = get_array_info(path_elems[0]); // n.b. only key is unused return j[index]; } From 10c64d6dbb48df4dc1fb14731f13ac10302bf8b9 Mon Sep 17 00:00:00 2001 From: Marcos Bento Date: Tue, 26 Mar 2024 16:38:53 +0000 Subject: [PATCH 4/7] Silence compilation warning [-Wchar-subscripts] --- libs/rest/src/ecflow/http/Base64.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/rest/src/ecflow/http/Base64.hpp b/libs/rest/src/ecflow/http/Base64.hpp index 44c332ed8..34b8b5dfc 100644 --- a/libs/rest/src/ecflow/http/Base64.hpp +++ b/libs/rest/src/ecflow/http/Base64.hpp @@ -64,10 +64,11 @@ inline unsigned char* base64_decode(const unsigned char* src, size_t len, size_t memset(dtable, 0x80, 256); for (size_t i = 0; i < sizeof(base64_table) - 1; i++) { - dtable[base64_table[i]] = (unsigned char)i; + auto base64_char = static_cast(base64_table[i]); + dtable[base64_char] = (unsigned char)i; } - int assignment = '='; - dtable[assignment] = 0; + size_t assignment_char = '='; + dtable[assignment_char] = 0; size_t count = 0; for (size_t i = 0; i < len; i++) { From 7d9cb2a0594381b32f688d65af196de15b68dc35 Mon Sep 17 00:00:00 2001 From: Marcos Bento Date: Tue, 26 Mar 2024 16:53:59 +0000 Subject: [PATCH 5/7] Silence compilation warning [-Wunused-variable] --- libs/rest/src/ecflow/http/Client.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/rest/src/ecflow/http/Client.cpp b/libs/rest/src/ecflow/http/Client.cpp index d1ff8fe2d..cd7661bb1 100644 --- a/libs/rest/src/ecflow/http/Client.cpp +++ b/libs/rest/src/ecflow/http/Client.cpp @@ -31,8 +31,8 @@ const char* const ECF_PASS = getenv("ECF_PASS"); bool authenticate(const httplib::Request& request, ClientInvoker* ci) { - auto auth_with_token = [&](const std::string& token) { #ifdef ECF_OPENSSL + auto auth_with_token = [&](const std::string& token) { if (TokenStorage::instance().verify(token)) { if (ECF_USER != nullptr && ECF_PASS != nullptr) { ci->set_user_name(std::string(ECF_USER)); @@ -40,9 +40,9 @@ bool authenticate(const httplib::Request& request, ClientInvoker* ci) { } return true; } -#endif return false; }; +#endif const auto& header = request.headers; From 497cff26b207df517046526e11b09f008dfd0574 Mon Sep 17 00:00:00 2001 From: Marcos Bento Date: Tue, 26 Mar 2024 17:22:59 +0000 Subject: [PATCH 6/7] Silence Clang warnings for AppleClang --- cmake/CompilerOptions.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/CompilerOptions.cmake b/cmake/CompilerOptions.cmake index f9aefcae3..397009696 100644 --- a/cmake/CompilerOptions.cmake +++ b/cmake/CompilerOptions.cmake @@ -61,12 +61,18 @@ if (HAVE_WARNINGS) $<$,$>:-Wno-deprecated-declarations> $<$,$>:-Wno-unused-result> $<$,$>:-Wno-unused-parameter> - ## Clang (MacOS AppleClang + Homebrew, AMD Clang-base) + ## Clang (MacOS Homebrew, AMD Clang-base) $<$,$>:-Wno-deprecated-copy-with-user-provided-copy> # silence warnings in Qt5 related headers $<$,$>:-Wno-deprecated-declarations> $<$,$>:-Wno-missing-field-initializers> # silence warning in Boost.Python related headers $<$,$>:-Wno-overloaded-virtual> $<$,$>:-Wno-unused-parameter> + ## Clang (MacOS AppleClang) + $<$,$>:-Wno-deprecated-copy-with-user-provided-copy> # silence warnings in Qt5 related headers + $<$,$>:-Wno-deprecated-declarations> + $<$,$>:-Wno-missing-field-initializers> # silence warning in Boost.Python related headers + $<$,$>:-Wno-overloaded-virtual> + $<$,$>:-Wno-unused-parameter> ## Clang (Intel Clang-based) $<$,$>:-Wno-deprecated-copy-with-user-provided-copy> # silence warnings in Qt5 related headers $<$,$>:-Wno-deprecated-declarations> From 601bbabb1f48310001859d0a2d2cf80e4da248a2 Mon Sep 17 00:00:00 2001 From: Marcos Bento Date: Wed, 27 Mar 2024 07:41:55 +0000 Subject: [PATCH 7/7] Silence compilation warning [-Wunused-variable] --- libs/rest/src/ecflow/http/ApiV1.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/rest/src/ecflow/http/ApiV1.cpp b/libs/rest/src/ecflow/http/ApiV1.cpp index 3f91a2809..548ed62af 100644 --- a/libs/rest/src/ecflow/http/ApiV1.cpp +++ b/libs/rest/src/ecflow/http/ApiV1.cpp @@ -176,7 +176,8 @@ ojson filter_json(const ojson& j, const httplib::Request& r) { // special case: filter is .[INDEX], means that we return the // correct array element from root json element assuming it's an array if (path_elems.size() == 1 && path_elems[0][0] == '[' && path_elems[0][path_elems[0].size() - 1] == ']') { - [[maybe_unused]] const auto [key, index] = get_array_info(path_elems[0]); // n.b. only key is unused + const auto [key, index] = get_array_info(path_elems[0]); + (void)key; // Note: suppress unused variable warning return j[index]; }