From 7fec66dd1cb84392deae09239e680017e378be45 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Mon, 3 May 2021 23:59:20 +0430 Subject: [PATCH] LibWasm: Make clang happy by removing an 'extra' set of parenthesis These aren't actually an extra set, without them the fold operation would be syntactically invalid. Also remove possible cast of float->double/double->float in Value::to() --- Userland/Libraries/LibWasm/AbstractMachine/AbstractMachine.h | 2 +- Userland/Libraries/LibWasm/Parser/Parser.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWasm/AbstractMachine/AbstractMachine.h b/Userland/Libraries/LibWasm/AbstractMachine/AbstractMachine.h index 4f6169c2fa..94f5e29ce9 100644 --- a/Userland/Libraries/LibWasm/AbstractMachine/AbstractMachine.h +++ b/Userland/Libraries/LibWasm/AbstractMachine/AbstractMachine.h @@ -102,7 +102,7 @@ public: Optional result; m_value.visit( [&](auto value) { - if constexpr (!IsSame && !IsSame) + if constexpr (IsSame) result = value; }, [&](const FunctionAddress& address) { diff --git a/Userland/Libraries/LibWasm/Parser/Parser.cpp b/Userland/Libraries/LibWasm/Parser/Parser.cpp index 2dd0759b81..5a6ab098be 100644 --- a/Userland/Libraries/LibWasm/Parser/Parser.cpp +++ b/Userland/Libraries/LibWasm/Parser/Parser.cpp @@ -99,7 +99,9 @@ static ParseResult> parse_until_any_of(InputStream& str if (new_stream.has_any_error()) return with_eof_check(stream, ParseError::ExpectedValueOrTerminator); - if ((... || (byte == terminators))) { + constexpr auto equals = [](auto&& a, auto&& b) { return a == b; }; + + if ((... || equals(byte, terminators))) { result.terminator = byte; return result; }