Remove unused variable from stdlib/setenv.c
[platform/upstream/glibc.git] / stdlib / bug-getcontext.c
1 /* BZ 12420 */
2
3 #include <errno.h>
4 #include <fenv.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <ucontext.h>
8
9 static int
10 do_test (void)
11 {
12   if (FE_ALL_EXCEPT == 0)
13     {
14       printf("Skipping test; no support for FP exceptions.\n");
15       return 0;
16     }
17
18   int except_mask = 0;
19 #ifdef FE_DIVBYZERO
20   except_mask |= FE_DIVBYZERO;
21 #endif
22 #ifdef FE_INVALID
23   except_mask |= FE_INVALID;
24 #endif
25 #ifdef FE_OVERFLOW
26   except_mask |= FE_OVERFLOW;
27 #endif
28 #ifdef FE_UNDERFLOW
29   except_mask |= FE_UNDERFLOW;
30 #endif
31   int status = feenableexcept (except_mask);
32
33   except_mask = fegetexcept ();
34   if (except_mask == -1)
35     {
36       printf("\nBefore getcontext(): fegetexcept returned: %d\n",
37              except_mask);
38       return 1;
39     }
40
41   ucontext_t ctx;
42   status = getcontext(&ctx);
43   if (status)
44     {
45       printf("\ngetcontext failed, errno: %d.\n", errno);
46       return 1;
47     }
48
49   printf ("\nDone with getcontext()!\n");
50   fflush (NULL);
51
52   int mask = fegetexcept ();
53   if (mask != except_mask)
54     {
55       printf("\nAfter getcontext(): fegetexcept returned: %d, expected: %d.\n",
56              mask, except_mask);
57       return 1;
58     }
59
60   printf("\nAt end fegetexcept() returned %d, expected: %d.\n",
61          mask, except_mask);
62
63   return 0;
64 }
65
66 #define TEST_FUNCTION do_test ()
67 #include "../test-skeleton.c"