Print this page
remove support for non-ANSI compilation


   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) 1984, 1986, 1987, 1988, 1989 AT&T     */
  23 /*        All Rights Reserved   */
  24 
  25 
  26 /*


  27  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  28  * Use is subject to license terms.
  29  */
  30 
  31 #ifndef _SYS_VA_IMPL_H
  32 #define _SYS_VA_IMPL_H
  33 
  34 /*
  35  * An application should not include this header directly.  Instead it
  36  * should be included only through the inclusion of other Sun headers,
  37  * specifically <stdarg.h> and <varargs.h>.
  38  *
  39  * This header serves two purposes.
  40  *
  41  * First, it provides a common set of definitions that implementations
  42  * of the various standards for variable argument lists may use.  These
  43  * various standards are implemented in <varargs.h>, <stdarg.h>,
  44  * <iso/stdarg_iso.h>, <iso/stdarg_c99.h>, and <sys/varargs.h>.
  45  *
  46  * Second, it provides varying implementations of the common definitions,


 101  */
 102 
 103 #include <sys/va_list.h>
 104 
 105 #ifdef  __cplusplus
 106 extern "C" {
 107 #endif
 108 
 109 #if defined(__lint)     /* ---------------------------------------- protocol */
 110 
 111 #define __va_start(list, name)  ((list) = (__va_list)&name)
 112 #define __va_arg(list, type)    ((type *)(list))[0]
 113 #define __va_copy(to, from)     __va_void(((to) = (from)))
 114 /*ARGSUSED*/
 115 static void __va_end(__va_list list) { __va_end(list); }
 116 
 117 #elif defined(__BUILTIN_VA_STRUCT)      /* ------------------------ protocol */
 118 
 119 /* ISA __va_list structures defined in <sys/va_list.h> */
 120 
 121 #if defined(__STDC__)   /* source language is ISO C or C++ */
 122 
 123 void __builtin_va_start(__va_list, ...);
 124 void *__builtin_va_arg_incr(__va_list, ...);
 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 #define __va_start(list, name)  __builtin_va_start(list, 0)
 134 #define __va_arg(list, type)    \
 135         ((type *)__builtin_va_arg_incr(list, (type *)0))[0]
 136 #define __va_copy(to, from)     __va_void(((to)[0] = (from)[0]))
 137 #define __va_end(list)          __va_void(0)
 138 
 139 #elif defined(__BUILTIN_VA_ARG_INCR)    /* ------------------------ protocol */
 140 
 141 #define __va_start(list, name)  \
 142         __va_void(((list) = (__va_list)&__builtin_va_alist))
 143 #define __va_arg(list, type)    \
 144         ((type *)__builtin_va_arg_incr((type *)(list)))[0]
 145 #define __va_copy(to, from)     __va_void(((to) = (from)))
 146 #define __va_end(list)          __va_void(0)
 147 
 148 #elif defined(__GNUC__) && ((__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || \
 149         (__GNUC__ >= 3))             /* ------------------------ protocol */
 150 #if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))
 151 #define __va_start(list, name)  __builtin_stdarg_start(list, name)
 152 #else




   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) 1984, 1986, 1987, 1988, 1989 AT&T     */
  23 /*        All Rights Reserved   */
  24 
  25 
  26 /*
  27  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  28  *
  29  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  30  * Use is subject to license terms.
  31  */
  32 
  33 #ifndef _SYS_VA_IMPL_H
  34 #define _SYS_VA_IMPL_H
  35 
  36 /*
  37  * An application should not include this header directly.  Instead it
  38  * should be included only through the inclusion of other Sun headers,
  39  * specifically <stdarg.h> and <varargs.h>.
  40  *
  41  * This header serves two purposes.
  42  *
  43  * First, it provides a common set of definitions that implementations
  44  * of the various standards for variable argument lists may use.  These
  45  * various standards are implemented in <varargs.h>, <stdarg.h>,
  46  * <iso/stdarg_iso.h>, <iso/stdarg_c99.h>, and <sys/varargs.h>.
  47  *
  48  * Second, it provides varying implementations of the common definitions,


 103  */
 104 
 105 #include <sys/va_list.h>
 106 
 107 #ifdef  __cplusplus
 108 extern "C" {
 109 #endif
 110 
 111 #if defined(__lint)     /* ---------------------------------------- protocol */
 112 
 113 #define __va_start(list, name)  ((list) = (__va_list)&name)
 114 #define __va_arg(list, type)    ((type *)(list))[0]
 115 #define __va_copy(to, from)     __va_void(((to) = (from)))
 116 /*ARGSUSED*/
 117 static void __va_end(__va_list list) { __va_end(list); }
 118 
 119 #elif defined(__BUILTIN_VA_STRUCT)      /* ------------------------ protocol */
 120 
 121 /* ISA __va_list structures defined in <sys/va_list.h> */
 122 


 123 void __builtin_va_start(__va_list, ...);
 124 void *__builtin_va_arg_incr(__va_list, ...);
 125 







 126 #define __va_start(list, name)  __builtin_va_start(list, 0)
 127 #define __va_arg(list, type)    \
 128         ((type *)__builtin_va_arg_incr(list, (type *)0))[0]
 129 #define __va_copy(to, from)     __va_void(((to)[0] = (from)[0]))
 130 #define __va_end(list)          __va_void(0)
 131 
 132 #elif defined(__BUILTIN_VA_ARG_INCR)    /* ------------------------ protocol */
 133 
 134 #define __va_start(list, name)  \
 135         __va_void(((list) = (__va_list)&__builtin_va_alist))
 136 #define __va_arg(list, type)    \
 137         ((type *)__builtin_va_arg_incr((type *)(list)))[0]
 138 #define __va_copy(to, from)     __va_void(((to) = (from)))
 139 #define __va_end(list)          __va_void(0)
 140 
 141 #elif defined(__GNUC__) && ((__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || \
 142         (__GNUC__ >= 3))             /* ------------------------ protocol */
 143 #if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))
 144 #define __va_start(list, name)  __builtin_stdarg_start(list, name)
 145 #else