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.
This commit is contained in:
parent
1a4206dd85
commit
b5fd024b77
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user