home *** CD-ROM | disk | FTP | other *** search
- /* Check whether setjmp actually saves registers in jmp_buf. */
- /* If it doesn't, the generic mark_regs code won't work. */
- #include <stdio.h>
- #include <setjmp.h>
- #include "gc.h"
- main()
- {
- jmp_buf b;
- register int x = 1;
- static int y = 0;
-
- setjmp(b);
- if (y == 1) {
- if (x == 2) {
- printf("Generic mark_regs code wont work\n");
- # ifdef SPARC
- printf("Assembly code supplied\n");
- # else
- printf("Need assembly code\n");
- # endif
- } else if (x == 1) {
- printf("Generic mark_regs code may work\n");
- } else {
- printf("Very strange setjmp implementation\n");
- }
- }
- y++;
- x = 2;
- if (y == 1) longjmp(b);
- return(0);
- }
-
- int g(x)
- int x;
- {
- return(x);
- }
-