summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2021-03-24 16:51:11 -0700
committerGitHub <noreply@github.com>2021-03-24 23:51:11 +0000
commit78de694ceb1b642076050d75c26ce4c1bf996b31 (patch)
tree612ad9aab7eb6040e80dd12dd36151d6b4c9b4a2
parent55af054b6b0b6d30fca7da43ac1c4522ff812e67 (diff)
downloadbinaryen-78de694ceb1b642076050d75c26ce4c1bf996b31.tar.gz
binaryen-78de694ceb1b642076050d75c26ce4c1bf996b31.tar.bz2
binaryen-78de694ceb1b642076050d75c26ce4c1bf996b31.zip
Resolve unused variable `globalStore` (#3729)
This variable is only used when asserts are enabled, so it was causing compilation errors on optimized builds with -Wunused-variable -Werror. This PR fixes the build errors by hiding the variable and its uses behind ifdefs.
-rw-r--r--src/wasm/wasm-type.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp
index a7040b959..12b223707 100644
--- a/src/wasm/wasm-type.cpp
+++ b/src/wasm/wasm-type.cpp
@@ -372,7 +372,9 @@ template<typename Info> struct Store {
// Maps from constructed types to their canonical Type IDs.
std::unordered_map<std::reference_wrapper<const Info>, uintptr_t> typeIDs;
+#ifndef NDEBUG
bool isGlobalStore();
+#endif
TypeID recordCanonical(std::unique_ptr<Info>&& info);
typename Info::type_t canonicalize(const Info& info);
@@ -396,18 +398,24 @@ HeapTypeStore globalHeapTypeStore;
template<typename T> struct MetaTypeInfo {};
template<> struct MetaTypeInfo<Type> {
+#ifndef NDEBUG
constexpr static TypeStore& globalStore = globalTypeStore;
+#endif
static TypeInfo* getInfo(Type type) { return getTypeInfo(type); }
};
template<> struct MetaTypeInfo<HeapType> {
+#ifndef NDEBUG
constexpr static HeapTypeStore& globalStore = globalHeapTypeStore;
+#endif
static HeapTypeInfo* getInfo(HeapType ht) { return getHeapTypeInfo(ht); }
};
+#ifndef NDEBUG
template<typename Info> bool Store<Info>::isGlobalStore() {
return this == &MetaTypeInfo<typename Info::type_t>::globalStore;
}
+#endif
template<typename Info>
TypeID Store<Info>::recordCanonical(std::unique_ptr<Info>&& info) {