From 77666631390e55a71962adc1252ee78a975485a9 Mon Sep 17 00:00:00 2001 From: bde Date: Tue, 25 Oct 1994 14:11:35 +0000 Subject: 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. --- include/setjmp.h | 24 +++++++++++++----------- 1 file 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 __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 -- cgit v1.1