Skip to content

Commit

Permalink
add workaround for the GCC 14 warning false positive
Browse files Browse the repository at this point in the history
  • Loading branch information
i80287 committed Oct 29, 2024
1 parent 7a2db6b commit 2f8bc52
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tf_idf_actrie/actrie.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,16 @@ class [[nodiscard]] ReplacingACTrieBuilder final
bool AddPatternWithReplacement(std::string_view pattern, std::string replacement) {
bool added = Base::AddPattern(pattern);
if (added) {
#if defined(__GNUG__) && __GNUG__ == 14 && !defined(__clang__)
// Bug in GCC 14: false positive may occur with
// warning -Walloc-size-larger-than=x if x < 9223372036854775776
#pragma GCC diagnostic push
#pragma GCC diagnostic warning "-Wno-alloc-size-larger-than"
#endif
words_replacements_.push_back(std::move(replacement));
#if defined(__GNUG__) && __GNUG__ == 14 && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
}
return added;
}
Expand Down

0 comments on commit 2f8bc52

Please sign in to comment.