1
0
mirror of https://github.com/fluencelabs/wasmer synced 2024-12-15 15:15:40 +00:00
wasmer/lib/emscripten-tests/emtests/test_siglongjmp.c

29 lines
767 B
C

/*
* Copyright 2017 The Emscripten Authors. All rights reserved.
* Emscripten is available under two separate licenses, the MIT license and the
* University of Illinois/NCSA Open Source License. Both these licenses can be
* found in the LICENSE file.
*/
#include <setjmp.h>
#include <stdio.h>
// TODO: Once signals are supported, improve this test to verify preservation of signals state
int main() {
sigjmp_buf env;
volatile int flag = 0;
if (sigsetjmp(env, 1) == 0) {
// Cannot print anything here, because siglongjmp will
// print a warning in between but only with ASSERTIONS enabled
flag = 1;
siglongjmp(env, 1);
} else {
if (flag) {
puts("Success");
}
}
return 0;
}