about summary refs log tree commit diff
path: root/setjmp/tst-setjmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'setjmp/tst-setjmp.c')
-rw-r--r--setjmp/tst-setjmp.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/setjmp/tst-setjmp.c b/setjmp/tst-setjmp.c
index 53fee89864..6147ae9567 100644
--- a/setjmp/tst-setjmp.c
+++ b/setjmp/tst-setjmp.c
@@ -52,6 +52,29 @@ main (void)
 	jump (value + 1);
     }
 
+  if (!lose && value == 10)
+    {
+      /* Do a second test, this time without `setjmp' being a macro.  */
+#undef setjmp
+      value = setjmp (env);
+      if (value != last_value + 1)
+	{
+	  fputs("Shouldn't have ", stdout);
+	  lose = 1;
+	}
+      last_value = value;
+      switch (value)
+	{
+	case 0:
+	  puts("Saved environment.");
+	  jump (0);
+	default:
+	  printf ("Jumped to %d.\n", value);
+	  if (value < 10)
+	    jump (value + 1);
+	}
+    }
+
   if (lose || value != 10)
     puts ("Test FAILED!");
   else