summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-03-19 08:49:15 -0700
committerGitHub <noreply@github.com>2021-03-19 08:49:15 -0700
commit5d9a6049c08c3b9e7ddb0c061f15b2731c6bad77 (patch)
tree0cb5686ae3b91c2253593727d04214fb08f8126b /src
parent86f05289d8fb50875d58ed491380bb8b4097d4eb (diff)
downloadbinaryen-5d9a6049c08c3b9e7ddb0c061f15b2731c6bad77.tar.gz
binaryen-5d9a6049c08c3b9e7ddb0c061f15b2731c6bad77.tar.bz2
binaryen-5d9a6049c08c3b9e7ddb0c061f15b2731c6bad77.zip
Avoid warnings/errors on isTemp(*Type) being unused (#3707)
It is a little "fun" to fake their uses because of the overloaded type. cppreference says that this is the way to do it, and I've found no other way than a C cast like this (std::function fails).
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-type.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp
index 772f256b7..f46d90854 100644
--- a/src/wasm/wasm-type.cpp
+++ b/src/wasm/wasm-type.cpp
@@ -206,9 +206,21 @@ Type markTemp(Type type) {
return type;
}
-bool isTemp(Type type) { return !type.isBasic() && getTypeInfo(type)->isTemp; }
+bool isTemp(Type type) {
+ // Avoid compiler warnings on this function not being used, as it is only used
+ // in assertions, which might be off.
+ bool (*func)(Type) = isTemp;
+ WASM_UNUSED(func);
+
+ return !type.isBasic() && getTypeInfo(type)->isTemp;
+}
bool isTemp(HeapType type) {
+ // Avoid compiler warnings on this function not being used, as it is only used
+ // in assertions, which might be off.
+ bool (*func)(HeapType) = isTemp;
+ WASM_UNUSED(func);
+
return !type.isBasic() && getHeapTypeInfo(type)->isTemp;
}