diff options
author | Roland McGrath <roland@gnu.org> | 1992-04-10 21:47:22 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1992-04-10 21:47:22 +0000 |
commit | 8788700957f902c34796169a2040d3c7ac0c6036 (patch) | |
tree | 6d8894c05b6256d4747790f67728f5ee35899f3f /setjmp | |
parent | 4e49ec5bc904d308acdfb51a5d9583d58a107a44 (diff) |
Formerly setjmp/setjmp.h.~7~
Diffstat (limited to 'setjmp')
-rw-r--r-- | setjmp/setjmp.h | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/setjmp/setjmp.h b/setjmp/setjmp.h index c4834f99f4..0b1b125d37 100644 --- a/setjmp/setjmp.h +++ b/setjmp/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 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 @@ -28,6 +28,22 @@ Cambridge, MA 02139, USA. */ /* Get the machine-dependent definition of `__jmp_buf'. */ #include <jmp_buf.h> + +#ifdef __FAVOR_BSD + +/* BSD defines `setjmp' and `longjmp' to save and restore the set of + blocked signals. For this, `jmp_buf' must be what POSIX calls + `sigjmp_buf', which includes that information. */ +typedef sigjmp_buf jmp_buf; + +#else /* Don't favor BSD. */ + +/* A `jmp_buf' really is a `jmp_buf'. Oh boy. */ +typedef __jmp_buf jmp_buf; + +#endif /* Favor BSD. */ + + #ifndef __NORETURN #ifdef __GNUC__ /* The `volatile' keyword tells GCC that a function never returns. */ @@ -40,16 +56,16 @@ Cambridge, MA 02139, USA. */ /* Jump to the environment saved in ENV, making the setjmp call there return VAL, or 1 if VAL is 0. */ extern __NORETURN void EXFUN(__longjmp, (CONST __jmp_buf __env, int __val)); -extern __NORETURN void EXFUN(longjmp, (CONST __jmp_buf __env, int __val)); +extern __NORETURN void EXFUN(longjmp, (CONST jmp_buf __env, int __val)); #ifdef __OPTIMIZE__ -#define longjmp(env, val) __longjmp((env), (val)) +#define longjmp(env, val) __longjmp ((env), (val)) #endif /* Optimizing. */ /* Set ENV to the current position and return 0. */ extern int EXFUN(__setjmp, (__jmp_buf __env)); -/* The ANSI standard says `setjmp' is a macro. */ -#define setjmp(env) __setjmp(env) +/* The ANSI C standard says `setjmp' is a macro. */ +#define setjmp(env) __setjmp (env) #ifdef __USE_POSIX @@ -60,8 +76,8 @@ extern int EXFUN(__setjmp, (__jmp_buf __env)); typedef struct { __jmp_buf __jmpbuf; /* Calling environment. */ + int __savemask; /* Saved the signal mask? */ sigset_t __sigmask; /* Saved signal mask. */ - unsigned int __savemask:1; /* Saved the signal mask? */ } sigjmp_buf[1]; /* Store the calling environment in ENV, also saving the @@ -76,33 +92,22 @@ extern __NORETURN void EXFUN(siglongjmp, (CONST sigjmp_buf __env, int __val)); #ifdef __USE_BSD -extern __NORETURN void EXFUN(_longjmp, (CONST __jmp_buf __env, int __val)); -extern int EXFUN(_setjmp, (__jmp_buf __env)); +extern __NORETURN void EXFUN(_longjmp, (CONST jmp_buf __env, int __val)); +extern int EXFUN(_setjmp, (jmp_buf __env)); #ifdef __OPTIMIZE__ -#define _longjmp(env, val) longjmp((env), (val)) -#define _setjmp(env) __setjmp(env) +#define _longjmp(env, val) siglongjmp ((env), (val)) +#define _setjmp(env) sigsetjmp ((env), 0) #endif /* Optimizing. */ #endif /* Use BSD. */ -#ifdef __FAVOR_BSD - -/* BSD defines `setjmp' and `longjmp' to save and restore the set of - blocked signals. For this, `jmp_buf' must be what POSIX calls - `sigjmp_buf', which includes that information. */ -typedef sigjmp_buf jmp_buf; +#ifdef __FAVOR_BSD #undef setjmp -#define setjmp(env) sigsetjmp((env), 1) - #undef longjmp -#define longjmp(env, val) siglongjmp((env), (val)) - -#else /* Don't favor BSD. */ - -/* A `jmp_buf' really is a `jmp_buf'. Oh boy. */ -typedef __jmp_buf jmp_buf; - +#define setjmp(env) sigsetjmp ((env), 1) +#define longjmp(env, val) siglongjmp ((env), (val)) #endif /* Favor BSD. */ + #endif /* setjmp.h */ |