wasmer/lib/emscripten/emtests/test_siglongjmp.c

29 lines
767 B
C
Raw Normal View History

2018-12-27 07:46:41 +00:00
/*
* 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;
}