diff options
author | bde <bde@FreeBSD.org> | 1994-10-25 14:11:35 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1994-10-25 14:11:35 +0000 |
commit | 77666631390e55a71962adc1252ee78a975485a9 (patch) | |
tree | b952feef6c59ffaf13fee6a1fab9bc7f9e9456aa /include/setjmp.h | |
parent | 4c2e71825c29b3dd064e493c10781700c7ff7fef (diff) | |
download | FreeBSD-src-77666631390e55a71962adc1252ee78a975485a9.zip FreeBSD-src-77666631390e55a71962adc1252ee78a975485a9.tar.gz |
Improve error detection and handling:
Reduce _JBLEN for the i386 to what is actually used.
Encapsulate jmp_buf and sigjmp_buf in structs.
Enlarge jmp_buf to the same size as sigjmp_buf.
Declare *longjmp as non-returning.
Remove stale comments about sig*jmp not being implemented.
Diffstat (limited to 'include/setjmp.h')
-rw-r--r-- | include/setjmp.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/include/setjmp.h b/include/setjmp.h index 8ac1443..c261c87 100644 --- a/include/setjmp.h +++ b/include/setjmp.h @@ -46,7 +46,7 @@ #endif #if defined(i386) || defined(__i386__) -#define _JBLEN 10 +#define _JBLEN 8 #endif #if defined(mips) || defined(__mips__) @@ -65,32 +65,34 @@ #define _JBLEN 10 #endif -#ifndef _ANSI_SOURCE /* - * WARNING: sigsetjmp() isn't supported yet, this is a placeholder. + * jmp_buf and sigjmp_buf are encapsulated in different structs to force + * compile-time diagnostics for mismatches. The structs are the same + * internally to avoid some run-time errors for mismatches. */ -typedef int sigjmp_buf[_JBLEN + 1]; +#ifndef _ANSI_SOURCE +typedef struct { int _sjb[_JBLEN + 1]; } sigjmp_buf[1]; #endif /* not ANSI */ -typedef int jmp_buf[_JBLEN]; +typedef struct { int _jb[_JBLEN + 1]; } jmp_buf[1]; #include <sys/cdefs.h> __BEGIN_DECLS int setjmp __P((jmp_buf)); -void longjmp __P((jmp_buf, int)); +__dead +void longjmp __P((jmp_buf, int)) __dead2; #ifndef _ANSI_SOURCE -/* - * WARNING: sigsetjmp() isn't supported yet, this is a placeholder. - */ int sigsetjmp __P((sigjmp_buf, int)); -void siglongjmp __P((sigjmp_buf, int)); +__dead +void siglongjmp __P((sigjmp_buf, int)) __dead2; #endif /* not ANSI */ #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) int _setjmp __P((jmp_buf)); -void _longjmp __P((jmp_buf, int)); +__dead +void _longjmp __P((jmp_buf, int)) __dead2; void longjmperror __P((void)); #endif /* neither ANSI nor POSIX */ __END_DECLS |