diff --git a/src/ir/metadata.cpp b/src/ir/metadata.cpp index f69927ecc10..a717766e627 100644 --- a/src/ir/metadata.cpp +++ b/src/ir/metadata.cpp @@ -76,9 +76,6 @@ void copyBetweenFunctions(Expression* origin, } } -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" - // Given two expressions to use as keys, see if they have identical values (or // are both absent) in two maps. template @@ -138,6 +135,4 @@ bool equal(Function* a, Function* b) { return true; } -#pragma GCC diagnostic pop - } // namespace wasm::metadata diff --git a/src/parser/wast-parser.cpp b/src/parser/wast-parser.cpp index 721b6126948..acc584fff38 100644 --- a/src/parser/wast-parser.cpp +++ b/src/parser/wast-parser.cpp @@ -520,9 +520,6 @@ Result command(Lexer& in) { return *module; } -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" - Result wast(Lexer& in) { WASTScript cmds; while (!in.empty()) { @@ -548,8 +545,6 @@ Result wast(Lexer& in) { return cmds; } -#pragma GCC diagnostic pop - } // anonymous namespace Result parseScript(std::string_view in) { diff --git a/src/parser/wat-parser.h b/src/parser/wat-parser.h index ba1236ad9a5..d0bb3f481a2 100644 --- a/src/parser/wat-parser.h +++ b/src/parser/wat-parser.h @@ -41,17 +41,12 @@ Result<> parseModuleBody(Module& wasm, Lexer& lexer); Result parseConst(Lexer& lexer); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" - struct InvokeAction { std::optional base; Name name; Literals args; }; -#pragma GCC diagnostic pop - struct GetAction { std::optional base; Name name; diff --git a/src/passes/Strip.cpp b/src/passes/Strip.cpp index 51a12188352..19bc099de08 100644 --- a/src/passes/Strip.cpp +++ b/src/passes/Strip.cpp @@ -27,9 +27,6 @@ namespace wasm { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" - struct Strip : public Pass { bool requiresNonNullableLocalFixups() override { return false; } @@ -77,6 +74,4 @@ Pass* createStripProducersPass() { }); } -#pragma GCC diagnostic pop - } // namespace wasm diff --git a/src/support/istring.h b/src/support/istring.h index dad20b8fb00..162a9601986 100644 --- a/src/support/istring.h +++ b/src/support/istring.h @@ -36,9 +36,11 @@ struct IString { static std::string_view interned(std::string_view s, bool reuse = true); public: - const std::string_view str; + std::string_view str; IString() = default; + IString(const IString& other) = default; + IString& operator=(const IString& other) = default; // TODO: This is a wildly unsafe default inherited from the previous // implementation. Change it? @@ -49,12 +51,6 @@ struct IString { IString(const char* str) : str(interned(str, false)) {} IString(const std::string& str) : str(interned(str, false)) {} - IString(const IString& other) = default; - - IString& operator=(const IString& other) { - return *(new (this) IString(other)); - } - bool operator==(const IString& other) const { // Fast! No need to compare contents due to interning return str.data() == other.str.data(); diff --git a/src/support/string.cpp b/src/support/string.cpp index bdb54f11f94..18f5cb51f7e 100644 --- a/src/support/string.cpp +++ b/src/support/string.cpp @@ -365,9 +365,6 @@ std::ostream& writeWTF16CodePoint(std::ostream& os, uint32_t u) { return os; } -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" - bool convertWTF8ToWTF16(std::ostream& os, std::string_view str) { bool valid = true; bool lastWasLeadingSurrogate = false; @@ -393,8 +390,6 @@ bool convertWTF8ToWTF16(std::ostream& os, std::string_view str) { return valid; } -#pragma GCC diagnostic pop - bool convertWTF16ToWTF8(std::ostream& os, std::string_view str) { return doConvertWTF16ToWTF8(os, str, true); } diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 4f979817226..960e86ffc82 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -4457,10 +4457,7 @@ class ModuleRunnerBase : public ExpressionRunner { const auto& seg = *wasm.getDataSegment(curr->segment); auto elemBytes = element.getByteSize(); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" - - uint64_t end; + uint64_t end = 0; if (std::ckd_add(&end, offset, size * elemBytes) || end > seg.data.size()) { trap("out of bounds segment access in array.new_data"); } @@ -4473,8 +4470,6 @@ class ModuleRunnerBase : public ExpressionRunner { contents.push_back(this->makeFromMemory(addr, element)); } -#pragma GCC diagnostic pop - return self()->makeGCData(std::move(contents), curr->type); } Flow visitArrayNewElem(ArrayNewElem* curr) { diff --git a/src/wasm-type.h b/src/wasm-type.h index 0636181d299..b8d3632cb71 100644 --- a/src/wasm-type.h +++ b/src/wasm-type.h @@ -100,7 +100,7 @@ class HeapType { // stack, `HeapType` is used to describe the structures that reference types // refer to. HeapTypes are canonicalized and interned exactly like Types and // should also be passed by value. - uintptr_t id; + uintptr_t id = 0; static constexpr int TypeBits = 2; static constexpr int UsedBits = TypeBits + 1;