xref: /titanic_52/usr/src/head/iso/setjmp_iso.h (revision f6e214c7418f43af38bd8c3a557e3d0a1d311cfa)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*	Copyright (c) 1988 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 /*
27  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 /*
32  * An application should not include this header directly.  Instead it
33  * should be included only through the inclusion of other Sun headers.
34  *
35  * The contents of this header is limited to identifiers specified in the
36  * C Standard.  Any new identifiers specified in future amendments to the
37  * C Standard must be placed in this header.  If these new identifiers
38  * are required to also be in the C++ Standard "std" namespace, then for
39  * anything other than macro definitions, corresponding "using" directives
40  * must also be added to <setjmp.h>.
41  */
42 
43 #ifndef _ISO_SETJMP_ISO_H
44 #define	_ISO_SETJMP_ISO_H
45 
46 #pragma ident	"%Z%%M%	%I%	%E% SMI"
47 /* SVr4.0 1.9.2.9 */
48 
49 #include <sys/feature_tests.h>
50 
51 #ifdef	__cplusplus
52 extern "C" {
53 #endif
54 
55 #ifndef _JBLEN
56 
57 /*
58  * The sizes of the jump-buffer (_JBLEN) and the sigjump-buffer
59  * (_SIGJBLEN) are defined by the appropriate, processor specific,
60  * ABI.
61  */
62 #if defined(__amd64)
63 #define	_JBLEN		8	/* ABI value */
64 #define	_SIGJBLEN	128	/* ABI value */
65 #elif defined(__i386)
66 #define	_JBLEN		10	/* ABI value */
67 #define	_SIGJBLEN	128	/* ABI value */
68 #elif defined(__sparcv9)
69 #define	_JBLEN		12	/* ABI value */
70 #define	_SIGJBLEN	19	/* ABI value */
71 #elif defined(__sparc)
72 #define	_JBLEN		12	/* ABI value */
73 #define	_SIGJBLEN	19	/* ABI value */
74 #else
75 #error "ISA not supported"
76 #endif
77 
78 #if __cplusplus >= 199711L
79 namespace std {
80 #endif
81 
82 #if defined(__i386) || defined(__amd64) || \
83 	defined(__sparc) || defined(__sparcv9)
84 #if defined(_LP64) || defined(_I32LPx)
85 typedef long	jmp_buf[_JBLEN];
86 #else
87 typedef int	jmp_buf[_JBLEN];
88 #endif
89 #else
90 #error "ISA not supported"
91 #endif
92 
93 #if defined(__STDC__)
94 
95 extern int setjmp(jmp_buf);
96 #pragma unknown_control_flow(setjmp)
97 extern int _setjmp(jmp_buf);
98 #pragma unknown_control_flow(_setjmp)
99 extern void longjmp(jmp_buf, int) __NORETURN;
100 extern void _longjmp(jmp_buf, int) __NORETURN;
101 
102 #else
103 
104 extern int setjmp();
105 #pragma unknown_control_flow(setjmp)
106 extern int _setjmp();
107 #pragma unknown_control_flow(_setjmp)
108 extern void longjmp();
109 extern void _longjmp();
110 
111 #endif  /* __STDC__ */
112 
113 #if __cplusplus >= 199711L
114 }
115 #endif /* end of namespace std */
116 
117 #if __cplusplus >= 199711L
118 using std::setjmp;
119 #endif
120 
121 #if defined(_STRICT_STDC) || __cplusplus >= 199711L
122 #define	setjmp(env)	setjmp(env)
123 #endif
124 
125 #endif  /* _JBLEN */
126 
127 #ifdef	__cplusplus
128 }
129 #endif
130 
131 #endif	/* _ISO_SETJMP_ISO_H */
132