about summary refs log tree commit diff
path: root/stdlib/bug-getcontext.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2012-07-16 16:51:13 +0200
committerAndreas Schwab <schwab@linux-m68k.org>2012-07-16 18:46:40 +0200
commitd0cd7d02120a1700a9b9f2b5601c35142f1be44b (patch)
tree3d69f64089de108ff23f539e330ef78b893260ba /stdlib/bug-getcontext.c
parentdd31893430a76e81cbd8b5412c5894f27bab39c7 (diff)
downloadglibc-d0cd7d02120a1700a9b9f2b5601c35142f1be44b.tar.gz
glibc-d0cd7d02120a1700a9b9f2b5601c35142f1be44b.tar.xz
glibc-d0cd7d02120a1700a9b9f2b5601c35142f1be44b.zip
Fix bug-getcontext test
Diffstat (limited to 'stdlib/bug-getcontext.c')
-rw-r--r--stdlib/bug-getcontext.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index 7db49c8499..133ee91eff 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -9,10 +9,25 @@
 static int
 do_test (void)
 {
-#if FE_ALL_EXCEPT == 0
-  printf("Skipping test; no support for FP exceptions.\n");
-#else
-  int except_mask =  FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW;
+  if (FE_ALL_EXCEPT == 0)
+    {
+      printf("Skipping test; no support for FP exceptions.\n");
+      return 0;
+    }
+
+  int except_mask = 0;
+#ifdef FE_DIVBYZERO
+  except_mask |= FE_DIVBYZERO;
+#endif
+#ifdef FE_INVALID
+  except_mask |= FE_INVALID;
+#endif
+#ifdef FE_OVERFLOW
+  except_mask |= FE_OVERFLOW;
+#endif
+#ifdef FE_UNDERFLOW
+  except_mask |= FE_UNDERFLOW;
+#endif
   int status = feenableexcept (except_mask);
 
   except_mask = fegetexcept ();
@@ -44,7 +59,7 @@ do_test (void)
 
   printf("\nAt end fegetexcept() returned %d, expected: %d.\n",
 	 mask, except_mask);
-#endif
+
   return 0;
 }