summary refs log tree commit diff
path: root/setjmp
diff options
context:
space:
mode:
Diffstat (limited to 'setjmp')
-rw-r--r--setjmp/setjmp.h6
-rw-r--r--setjmp/tst-setjmp.c35
2 files changed, 37 insertions, 4 deletions
diff --git a/setjmp/setjmp.h b/setjmp/setjmp.h
index 75abb18c6d..eb4305f5bd 100644
--- a/setjmp/setjmp.h
+++ b/setjmp/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -51,7 +51,7 @@ extern int __sigsetjmp __P ((jmp_buf __env, int __savemask));
 #ifndef	__FAVOR_BSD
 /* Set ENV to the current position and return 0, not saving the signal mask.
    This is just like `sigsetjmp (ENV, 0)'.
-   The ANSI C standard says `setjmp' is a macro.  */
+   The ISO C standard says `setjmp' is a macro.  */
 #define	setjmp(env)	__sigsetjmp ((env), 0)
 #else
 /* We are in 4.3 BSD-compatibility mode in which `setjmp'
@@ -61,7 +61,7 @@ extern int __sigsetjmp __P ((jmp_buf __env, int __savemask));
 
 #ifdef __USE_BSD
 /* Set ENV to the current position and return 0, not saving the signal mask.
-   This is the 4.3 BSD name for ANSI `setjmp'.  */
+   This is the 4.3 BSD name for ISO `setjmp'.  */
 #define _setjmp(env)	__sigsetjmp ((env), 0)
 #endif
 
diff --git a/setjmp/tst-setjmp.c b/setjmp/tst-setjmp.c
index 6147ae9567..b4cba1177d 100644
--- a/setjmp/tst-setjmp.c
+++ b/setjmp/tst-setjmp.c
@@ -54,8 +54,14 @@ main (void)
 
   if (!lose && value == 10)
     {
-      /* Do a second test, this time without `setjmp' being a macro.  */
+      /* Do a second test, this time without `setjmp' being a macro.
+         This is not required by ISO C but we have this for compatibility.  */
 #undef setjmp
+      extern int setjmp (jmp_buf);
+
+      last_value = -1;
+      lose = 0;
+
       value = setjmp (env);
       if (value != last_value + 1)
 	{
@@ -75,6 +81,33 @@ main (void)
 	}
     }
 
+  if (!lose && value == 10)
+    {
+      /* And again for the `__setjmp' function.  */
+      extern int __setjmp (jmp_buf);
+
+      last_value = -1;
+      lose = 0;
+
+      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