From 37f71363a58ba9489a7b1c7910aeb80819af0a74 Mon Sep 17 00:00:00 2001 From: marehr Date: Thu, 25 Feb 2021 12:15:04 +0100 Subject: [PATCH] [FIX] gcc10: throws invalid deprecation warnings See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99318 --- include/seqan3/alphabet/alphabet_base.hpp | 9 +++++++++ include/seqan3/core/platform.hpp | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/include/seqan3/alphabet/alphabet_base.hpp b/include/seqan3/alphabet/alphabet_base.hpp index d3d7043c088..5f1aa12de28 100644 --- a/include/seqan3/alphabet/alphabet_base.hpp +++ b/include/seqan3/alphabet/alphabet_base.hpp @@ -217,8 +217,17 @@ class alphabet_base */ static constexpr rank_type char_to_rank_table(char_type const chr) noexcept { +#if SEQAN3_WORKAROUND_GCC_99318 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" + using index_t = std::make_unsigned_t; + index_t const id = static_cast(chr); + return derived_type::char_to_rank[id]; +# pragma GCC diagnostic pop +#else // ^^^ workaround / no workaround vvv using index_t = std::make_unsigned_t; return derived_type::char_to_rank[static_cast(chr)]; +#endif // SEQAN3_WORKAROUND_GCC_99318 } public: diff --git a/include/seqan3/core/platform.hpp b/include/seqan3/core/platform.hpp index fb9b0fdc35e..162e5f7571a 100644 --- a/include/seqan3/core/platform.hpp +++ b/include/seqan3/core/platform.hpp @@ -323,6 +323,15 @@ # endif #endif +//!\brief See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99318 +#ifndef SEQAN3_WORKAROUND_GCC_99318 // not yet fixed, this is a regression since gcc-10 +# if defined(__GNUC__) && (__GNUC__ >= 10) +# define SEQAN3_WORKAROUND_GCC_99318 1 +# else +# define SEQAN3_WORKAROUND_GCC_99318 0 +# endif +#endif + /*!\brief This is needed to support CentOS 7 or RHEL 7; Newer CentOS's include a more modern default-gcc version making * this macro obsolete. *