Print this page
remove support for non-ANSI compilation
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/va_impl.h
+++ new/usr/src/uts/common/sys/va_impl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 23 /* All Rights Reserved */
24 24
25 25
26 26 /*
27 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
28 + *
27 29 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
28 30 * Use is subject to license terms.
29 31 */
30 32
31 33 #ifndef _SYS_VA_IMPL_H
32 34 #define _SYS_VA_IMPL_H
33 35
34 36 /*
35 37 * An application should not include this header directly. Instead it
36 38 * should be included only through the inclusion of other Sun headers,
37 39 * specifically <stdarg.h> and <varargs.h>.
38 40 *
39 41 * This header serves two purposes.
40 42 *
41 43 * First, it provides a common set of definitions that implementations
42 44 * of the various standards for variable argument lists may use. These
43 45 * various standards are implemented in <varargs.h>, <stdarg.h>,
44 46 * <iso/stdarg_iso.h>, <iso/stdarg_c99.h>, and <sys/varargs.h>.
45 47 *
46 48 * Second, it provides varying implementations of the common definitions,
47 49 * depending upon the compiler.
48 50 */
49 51
50 52 /*
51 53 * The common definitions exported by this header or compilers using
52 54 * this header are:
53 55 *
54 56 * the macro __va_start(list, name) starting the list iteration
55 57 * the macro __va_arg(list, type) getting the current arg and iterating
56 58 * the macro __va_copy(to, from) to bookmark the list iteration
57 59 * the macro __va_end(list) to end the iteration
58 60 *
59 61 * In addition, the following are exported via inclusion of <sys/va_list.h>:
60 62 *
61 63 * the identifier __builtin_va_alist for the variable list pseudo parameter
62 64 * the type __va_alist_type for the variable list pseudo parameter
63 65 * the type __va_list defining the type of the variable list iterator
64 66 */
65 67
66 68 /*
67 69 * This header uses feature macros (e.g. __BUILTIN_VA_ARG_INCR and
68 70 * __BUILTIN_VA_STRUCT), compiler macros (e.g. __GNUC__), and processor
69 71 * macros (e.g. __sparc) to determine the protocol appropriate to the
70 72 * current compilation. It is intended that the compilation system
71 73 * define the feature, processor, and compiler macros, not the user of
72 74 * the system.
73 75 */
74 76
75 77 /*
76 78 * Many compilation systems depend upon the use of special functions
77 79 * built into the the compilation system to handle variable argument
78 80 * lists. These built-in symbols may include one or more of the
79 81 * following:
80 82 *
81 83 * __builtin_va_alist
82 84 * __builtin_va_start
83 85 * __builtin_va_arg_incr
84 86 * __builtin_stdarg_start
85 87 * __builtin_va_end
86 88 * __builtin_va_arg
87 89 * __builtin_va_copy
88 90 */
89 91
90 92 /*
91 93 * The following are defined in <sys/va_list.h>:
92 94 *
93 95 * __va_alist_type
94 96 * __va_void()
95 97 * __va_ptr_base
96 98 * ISA definitions via inclusion of <sys/isa_defs.h>
97 99 *
98 100 * Inclusion of this header also makes visible the symbols in <sys/va_list.h>.
99 101 * This header is included in <varargs.h>, <sys/varargs.h> and in <stdarg.h>
100 102 * via inclusion of <iso/stdarg_iso.h>.
101 103 */
102 104
103 105 #include <sys/va_list.h>
104 106
105 107 #ifdef __cplusplus
106 108 extern "C" {
107 109 #endif
108 110
109 111 #if defined(__lint) /* ---------------------------------------- protocol */
110 112
↓ open down ↓ |
74 lines elided |
↑ open up ↑ |
111 113 #define __va_start(list, name) ((list) = (__va_list)&name)
112 114 #define __va_arg(list, type) ((type *)(list))[0]
113 115 #define __va_copy(to, from) __va_void(((to) = (from)))
114 116 /*ARGSUSED*/
115 117 static void __va_end(__va_list list) { __va_end(list); }
116 118
117 119 #elif defined(__BUILTIN_VA_STRUCT) /* ------------------------ protocol */
118 120
119 121 /* ISA __va_list structures defined in <sys/va_list.h> */
120 122
121 -#if defined(__STDC__) /* source language is ISO C or C++ */
122 -
123 123 void __builtin_va_start(__va_list, ...);
124 124 void *__builtin_va_arg_incr(__va_list, ...);
125 125
126 -#else /* source language is K&R C */
127 -
128 -int __builtin_va_start();
129 -char *__builtin_va_arg_incr();
130 -
131 -#endif /* source language */
132 -
133 126 #define __va_start(list, name) __builtin_va_start(list, 0)
134 127 #define __va_arg(list, type) \
135 128 ((type *)__builtin_va_arg_incr(list, (type *)0))[0]
136 129 #define __va_copy(to, from) __va_void(((to)[0] = (from)[0]))
137 130 #define __va_end(list) __va_void(0)
138 131
139 132 #elif defined(__BUILTIN_VA_ARG_INCR) /* ------------------------ protocol */
140 133
141 134 #define __va_start(list, name) \
142 135 __va_void(((list) = (__va_list)&__builtin_va_alist))
143 136 #define __va_arg(list, type) \
144 137 ((type *)__builtin_va_arg_incr((type *)(list)))[0]
145 138 #define __va_copy(to, from) __va_void(((to) = (from)))
146 139 #define __va_end(list) __va_void(0)
147 140
148 141 #elif defined(__GNUC__) && ((__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || \
149 142 (__GNUC__ >= 3)) /* ------------------------ protocol */
150 143 #if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))
151 144 #define __va_start(list, name) __builtin_stdarg_start(list, name)
152 145 #else
153 146 #define __va_start(list, name) __builtin_va_start(list, name)
154 147 #endif
155 148
156 149 #define __va_arg(list, type) __builtin_va_arg(list, type)
157 150 #define __va_end(list) __builtin_va_end(list)
158 151 #define __va_copy(to, from) __builtin_va_copy(to, from)
159 152
160 153 #else /* ----------------------- protocol */
161 154
162 155 /*
163 156 * Because we can not predict the compiler protocol for unknown compilers, we
164 157 * force an error in order to avoid unpredictable behavior. For versions of
165 158 * gcc 2.95 and earlier, variable argument lists are handled in gcc specific
166 159 * stdarg.h and varargs.h headers created via the gcc fixincl utility. In
167 160 * those cases, the gcc headers would override this header.
168 161 */
169 162
170 163 #error("Unrecognized compiler protocol for variable argument lists")
171 164
172 165 #endif /* -------------------------------------------------------- protocol */
173 166
174 167 #ifdef __cplusplus
175 168 }
176 169 #endif
177 170
178 171 #endif /* _SYS_VA_IMPL_H */
↓ open down ↓ |
36 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX