From 0681ab9071e4caafcd0ae51c0989b3ee10af251f Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Fri, 16 May 2025 16:06:13 -0700 Subject: [PATCH] Fix clang-tidy modernize-use-transparent-functors findings --- .clang-tidy | 1 + src/RuleMatcher.cc | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 9e5143f0d9..2bb50aa443 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -13,6 +13,7 @@ Checks: [-*, modernize-use-emplace, modernize-use-nullptr, modernize-use-override, + modernize-use-transparent-functors, # Enable a very limited number of the cppcoreguidelines checkers. # See the notes for some of the rest of them below. diff --git a/src/RuleMatcher.cc b/src/RuleMatcher.cc index 56c077b21e..ed26ee7688 100644 --- a/src/RuleMatcher.cc +++ b/src/RuleMatcher.cc @@ -549,17 +549,17 @@ static inline bool match_not_and(const vector& prefixes, const IPAddr& static inline bool compare(const maskedvalue_list& mvals, uint32_t v, RuleHdrTest::Comp comp) { switch ( comp ) { - case RuleHdrTest::EQ: return match_or(mvals, v, std::equal_to()); break; + case RuleHdrTest::EQ: return match_or(mvals, v, std::equal_to<>()); break; - case RuleHdrTest::NE: return match_not_and(mvals, v, std::equal_to()); break; + case RuleHdrTest::NE: return match_not_and(mvals, v, std::equal_to<>()); break; - case RuleHdrTest::LT: return match_or(mvals, v, std::less()); break; + case RuleHdrTest::LT: return match_or(mvals, v, std::less<>()); break; - case RuleHdrTest::GT: return match_or(mvals, v, std::greater()); break; + case RuleHdrTest::GT: return match_or(mvals, v, std::greater<>()); break; - case RuleHdrTest::LE: return match_or(mvals, v, std::less_equal()); break; + case RuleHdrTest::LE: return match_or(mvals, v, std::less_equal<>()); break; - case RuleHdrTest::GE: return match_or(mvals, v, std::greater_equal()); break; + case RuleHdrTest::GE: return match_or(mvals, v, std::greater_equal<>()); break; default: reporter->InternalError("unknown RuleHdrTest comparison type"); break; } @@ -568,17 +568,17 @@ static inline bool compare(const maskedvalue_list& mvals, uint32_t v, RuleHdrTes static inline bool compare(const vector& prefixes, const IPAddr& a, RuleHdrTest::Comp comp) { switch ( comp ) { - case RuleHdrTest::EQ: return match_or(prefixes, a, std::equal_to()); break; + case RuleHdrTest::EQ: return match_or(prefixes, a, std::equal_to<>()); break; - case RuleHdrTest::NE: return match_not_and(prefixes, a, std::equal_to()); break; + case RuleHdrTest::NE: return match_not_and(prefixes, a, std::equal_to<>()); break; - case RuleHdrTest::LT: return match_or(prefixes, a, std::less()); break; + case RuleHdrTest::LT: return match_or(prefixes, a, std::less<>()); break; - case RuleHdrTest::GT: return match_or(prefixes, a, std::greater()); break; + case RuleHdrTest::GT: return match_or(prefixes, a, std::greater<>()); break; - case RuleHdrTest::LE: return match_or(prefixes, a, std::less_equal()); break; + case RuleHdrTest::LE: return match_or(prefixes, a, std::less_equal<>()); break; - case RuleHdrTest::GE: return match_or(prefixes, a, std::greater_equal()); break; + case RuleHdrTest::GE: return match_or(prefixes, a, std::greater_equal<>()); break; default: reporter->InternalError("unknown RuleHdrTest comparison type"); break; }