/* Copyright 07/20/98 Sun Microsystems, Inc. All Rights Reserved */ #if !defined(__STD_CSTDARG) && !defined(__STD_STDARG_H) #define __STD_CSTDARG #include typedef __va_list va_list; /* * Many compilation systems depend upon the use of special functions * built into the the compilation system to handle variable argument * lists and stack allocations. The method to obtain this in SunOS * is to define the feature test macro "__BUILTIN_VA_ARG_INCR" which * enables the following special built-in functions: * __builtin_alloca * __builtin_va_alist * __builtin_va_arg_incr * It is intended that the compilation system define this feature test * macro, not the user of the system. * * The tests on the processor type are to provide a transitional period * for existing compilation systems, and may be removed in a future * release. */ #if (defined(__BUILTIN_VA_ARG_INCR) || defined(sparc) || defined(__sparc) || \ defined(i386) || defined(__i386)) && !(defined(lint) || defined(__lint)) /* * Instruction set architectures which use a simple pointer to the * argument save area share a common implementation. */ #define va_start(list, name) (void) (list = (va_list) &__builtin_va_alist) #define va_arg(list, mode) ((mode *)__builtin_va_arg_incr((mode *)list))[0] #else /* defined(__BUILTIN_VA_ARG_INCR) && !(defined(lint) || ... ) */ #define va_start(list, name) (void) (list = (void *)((char *)&name + \ ((sizeof (name) + (sizeof (int) - 1)) & ~(sizeof (int) - 1)))) #define va_arg(list, mode) \ ((mode *)(list = (void *)((char *)list + sizeof (mode))))[-1] #endif /* defined(__BUILTIN_VA_ARG_INCR) && !(defined(lint) || ... ) */ extern "C" void va_end(va_list); #define va_end(list) (void)0 /* * va_copy is a Solaris extension to provide a portable way to perform * a variable argument list ``bookmarking'' function. */ #if defined(__EXTENSIONS__) || ((__STDC__ - 0 == 0) && \ !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) #define va_copy(to, from) ((to) = (from)) #endif /* defined(__EXTENSIONS__) || ((__STDC__ - 0 == 0) && ... ) */ namespace std { // C++ Standard functions and types /* * The type associated with va_list is defined in under the * implementation name __va_list. This protects the ANSI-C, POSIX and * XPG namespaces. Including this file allows (requires) the name va_list * to exist in the these namespaces. */ typedef __va_list va_list; } /* namespace std */ #endif /* __STD_stdarg */