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

Function main

test/core/test_longjmp.c:24–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24int main() {
25 volatile int x = 0;
26 int jmpval = setjmp(buf);
27 if (!jmpval) {
28 x++; // should be properly restored once longjmp jumps back
29 first(); // when executed, setjmp returns 1
30 printf("skipped\n"); // does not print
31 } else if (jmpval == 1) { // when first() jumps back, setjmp returns 1
32 printf("result: %d %d\n", x, jmpval); // prints
33 x++;
34 second(); // when executed, setjmp returns -1
35 } else if (jmpval == -1) { // when second() jumps back, setjmp returns -1
36 printf("result: %d %d\n", x, jmpval); // prints
37 }
38
39 return 0;
40}

Callers

nothing calls this directly

Calls 3

printfFunction · 0.85
firstFunction · 0.70
secondFunction · 0.70

Tested by

no test coverage detected