diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-07-30 20:46:55 +0300 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-08-01 11:20:27 +0000 |
commit | 9ad8debe38332a9d61a79e1b0017c19c442f4e49 (patch) | |
tree | 75c88f2794d94f947cb9ed60acde29b478b06025 | |
parent | 174061f9f32ac76c6b8a6d155d772e37708d8cfc (diff) |
qlalr: fix compilation with C++20
std::not1 is deprecated in C++17, removed in C++20.
Use its replacement, std::not_fn.
Change-Id: I37d4929c81c2a5befeb44f954ae77b23960d2ff0
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
-rw-r--r-- | src/tools/qlalr/lalr.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/tools/qlalr/lalr.cpp b/src/tools/qlalr/lalr.cpp index ec960925aa..541523d49c 100644 --- a/src/tools/qlalr/lalr.cpp +++ b/src/tools/qlalr/lalr.cpp @@ -295,6 +295,12 @@ void Automaton::build () buildDefaultReduceActions (); } +#if defined(__cpp_lib_not_fn) && __cpp_lib_not_fn >= 201603 +# define Q_NOT_FN std::not_fn +#else +# define Q_NOT_FN std::not1 +#endif + void Automaton::buildNullables () { bool changed = true; @@ -305,7 +311,7 @@ void Automaton::buildNullables () for (RulePointer rule = _M_grammar->rules.begin (); rule != _M_grammar->rules.end (); ++rule) { - NameList::iterator nn = std::find_if (rule->rhs.begin (), rule->rhs.end (), std::not1 (Nullable (this))); + NameList::iterator nn = std::find_if(rule->rhs.begin(), rule->rhs.end(), Q_NOT_FN(Nullable(this))); if (nn == rule->rhs.end ()) changed |= nullables.insert (rule->lhs).second; @@ -646,7 +652,7 @@ void Automaton::buildIncludesDigraph () if (! _M_grammar->isNonTerminal (*A)) continue; - NameList::iterator first_not_nullable = std::find_if (dot, rule->rhs.end (), std::not1 (Nullable (this))); + NameList::iterator first_not_nullable = std::find_if(dot, rule->rhs.end(), Q_NOT_FN(Nullable(this))); if (first_not_nullable != rule->rhs.end ()) continue; |