aboutsummaryrefslogtreecommitdiffstats
path: root/include/setjmp.h
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>1994-10-25 14:11:35 +0000
committerBruce Evans <bde@FreeBSD.org>1994-10-25 14:11:35 +0000
commitb5fd024b77240fea335c69b51cedc519273c4865 (patch)
treeb952feef6c59ffaf13fee6a1fab9bc7f9e9456aa /include/setjmp.h
parent1a4206dd854de834a34ea8ae31d7248ce544cf7b (diff)
downloadsrc-b5fd024b77240fea335c69b51cedc519273c4865.tar.gz
src-b5fd024b77240fea335c69b51cedc519273c4865.zip
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.
Notes
Notes: svn path=/head/; revision=3852
Diffstat (limited to 'include/setjmp.h')
-rw-r--r--include/setjmp.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/include/setjmp.h b/include/setjmp.h
index 8ac1443518e3..c261c8722c8b 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