summaryrefslogtreecommitdiff
path: root/test/example
diff options
context:
space:
mode:
Diffstat (limited to 'test/example')
-rw-r--r--test/example/c-api-kitchen-sink.c13
-rw-r--r--test/example/c-api-kitchen-sink.txt12
-rw-r--r--test/example/c-api-relooper-unreachable-if.cpp1
-rw-r--r--test/example/c-api-unused-mem.cpp1
4 files changed, 14 insertions, 13 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c
index a6a196ae6..93a6281f8 100644
--- a/test/example/c-api-kitchen-sink.c
+++ b/test/example/c-api-kitchen-sink.c
@@ -973,7 +973,7 @@ void test_core() {
// All the rest
BinaryenBlock(module, NULL, NULL, 0, -1), // block with no name and no type
BinaryenIf(module, temp1, temp2, temp3),
- BinaryenIf(module, temp4, temp5, NULL),
+ BinaryenIf(module, temp4, BinaryenDrop(module, temp5), NULL),
BinaryenLoop(module, "in", makeInt32(module, 0)),
BinaryenLoop(module, NULL, makeInt32(module, 0)),
BinaryenBreak(module, "the-value", temp6, temp7),
@@ -1232,6 +1232,14 @@ void test_core() {
BinaryenExpressionPrint(
valueList[3]); // test printing a standalone expression
+ // Add drops of concrete expressions
+ for (int i = 0; i < sizeof(valueList) / sizeof(valueList[0]); ++i) {
+ BinaryenType type = BinaryenExpressionGetType(valueList[i]);
+ if (type != BinaryenTypeNone() && type != BinaryenTypeUnreachable()) {
+ valueList[i] = BinaryenDrop(module, valueList[i]);
+ }
+ }
+
// Make the main body of the function. and one block with a return value, one
// without
BinaryenExpressionRef value =
@@ -1360,9 +1368,6 @@ void test_core() {
BinaryenNop(module));
BinaryenSetStart(module, starter);
- // A bunch of our code needs drop(), auto-add it
- BinaryenModuleAutoDrop(module);
-
BinaryenFeatures features = BinaryenFeatureAll();
BinaryenModuleSetFeatures(module, features);
assert(BinaryenModuleGetFeatures(module) == features);
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index 657999a55..8a5b6dc87 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -1964,15 +1964,13 @@ BinaryenFeatureAll: 524287
)
(block
)
- (if
- (i32.const 1)
- (then
- (drop
+ (drop
+ (if (result i32)
+ (i32.const 1)
+ (then
(i32.const 2)
)
- )
- (else
- (drop
+ (else
(i32.const 3)
)
)
diff --git a/test/example/c-api-relooper-unreachable-if.cpp b/test/example/c-api-relooper-unreachable-if.cpp
index 96c6c1149..8723aea83 100644
--- a/test/example/c-api-relooper-unreachable-if.cpp
+++ b/test/example/c-api-relooper-unreachable-if.cpp
@@ -13,7 +13,6 @@ int main() {
RelooperRef the_relooper = NULL;
the_module = BinaryenModuleCreate();
expressions[size_t(NULL)] = BinaryenExpressionRef(NULL);
- BinaryenModuleAutoDrop(the_module);
{
const char* segmentNames[] = {"0"};
const char* segmentDatas[] = {0};
diff --git a/test/example/c-api-unused-mem.cpp b/test/example/c-api-unused-mem.cpp
index 750f3b703..f8bce0074 100644
--- a/test/example/c-api-unused-mem.cpp
+++ b/test/example/c-api-unused-mem.cpp
@@ -14,7 +14,6 @@ int main() {
RelooperRef the_relooper = NULL;
the_module = BinaryenModuleCreate();
expressions[size_t(NULL)] = BinaryenExpressionRef(NULL);
- BinaryenModuleAutoDrop(the_module);
{
const char* segmentNames[] = {"0"};
const char* segmentDatas[] = {0};