MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / first_func

Function first_func

test/core/test_longjmp4.c:17–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15void second_func(jmp_state* s);
16
17void first_func(jmp_state* s) {
18 jmp_buf* prev_jmp = s->jmp;
19 jmp_buf c_jmp;
20 volatile int once = 0;
21
22 if (setjmp(c_jmp) == 0) {
23 printf("Normal execution path of first function!\n");
24
25 s->jmp = &c_jmp;
26 second_func(s);
27 } else {
28 printf("Exception execution path of first function! %d\n", once);
29
30 if (!once) {
31 printf("Calling longjmp the second time!\n");
32 once = 1;
33 longjmp(*(s->jmp), 1);
34 }
35 }
36}
37
38void second_func(jmp_state* s) { longjmp(*(s->jmp), 1); }
39

Callers 1

mainFunction · 0.85

Calls 2

printfFunction · 0.85
second_funcFunction · 0.85

Tested by

no test coverage detected