o Add conditionals to allow va_list to be defined in other headers.

o Standardize on _MACHINE_STDARG_H_ to allow multiple header includes.
o Restrict the definition of va_copy() to C99 environments.
This commit is contained in:
mike 2002-10-06 22:01:07 +00:00
parent df3f69ffb1
commit 20850bb1d6
6 changed files with 49 additions and 11 deletions

View File

@ -36,12 +36,16 @@
* $FreeBSD$
*/
#ifndef _ALPHA_STDARG_H_
#define _ALPHA_STDARG_H_
#ifndef _MACHINE_STDARG_H_
#define _MACHINE_STDARG_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
typedef __va_list va_list;
#ifndef _VA_LIST_DECLARED
#define _VA_LIST_DECLARED
typedef __va_list va_list;
#endif
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
@ -51,8 +55,10 @@ typedef __va_list va_list;
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
#if __ISO_C_VISIBLE >= 1999
#define va_copy(dest, src) \
__builtin_va_copy((dest), (src))
#endif
#define va_end(ap) \
__builtin_va_end(ap)
@ -83,4 +89,4 @@ typedef __va_list va_list;
#endif /* __GNUC__ post GCC 2.95 */
#endif /* !_ALPHA_STDARG_H_ */
#endif /* !_MACHINE_STDARG_H_ */

View File

@ -31,9 +31,13 @@
#ifndef _MACHINE_STDARG_H_
#define _MACHINE_STDARG_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
#ifndef _VA_LIST_DECLARED
#define _VA_LIST_DECLARED
typedef __va_list va_list;
#endif
#define va_start(ap, last) \
__builtin_stdarg_start((ap), (last))
@ -41,8 +45,10 @@ typedef __va_list va_list;
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
#if __ISO_C_VISIBLE >= 1999
#define va_copy(dest, src) \
__builtin_va_copy((dest), (src))
#endif
#define va_end(ap) \
__builtin_va_end(ap)

View File

@ -35,12 +35,16 @@
* $FreeBSD$
*/
#ifndef _STDARG_H_
#define _STDARG_H_
#ifndef _MACHINE_STDARG_H_
#define _MACHINE_STDARG_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
typedef __va_list va_list;
#ifndef _VA_LIST_DECLARED
#define _VA_LIST_DECLARED
typedef __va_list va_list;
#endif
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
@ -50,8 +54,10 @@ typedef __va_list va_list;
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
#if __ISO_C_VISIBLE >= 1999
#define va_copy(dest, src) \
__builtin_va_copy((dest), (src))
#endif
#define va_end(ap) \
__builtin_va_end(ap)
@ -77,4 +83,4 @@ typedef __va_list va_list;
#endif /* __GNUC__ post GCC 2.95 */
#endif /* !_STDARG_H_ */
#endif /* !_MACHINE_STDARG_H_ */

View File

@ -38,9 +38,13 @@
#ifndef _MACHINE_STDARG_H_
#define _MACHINE_STDARG_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
#ifndef _VA_LIST_DECLARED
#define _VA_LIST_DECLARED
typedef __va_list va_list;
#endif
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
@ -50,8 +54,10 @@ typedef __va_list va_list;
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
#if __ISO_C_VISIBLE >= 1999
#define va_copy(dest, src) \
__builtin_va_copy((dest), (src))
#endif
#define va_end(ap) \
__builtin_va_end(ap)

View File

@ -28,12 +28,16 @@
* $FreeBSD$
*/
#ifndef _POWERPC_STDARG_H_
#define _POWERPC_STDARG_H_
#ifndef _MACHINE_STDARG_H_
#define _MACHINE_STDARG_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
#ifndef _VA_LIST_DECLARED
#define _VA_LIST_DECLARED
typedef __va_list va_list;
#endif
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
@ -43,8 +47,10 @@ typedef __va_list va_list;
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
#if __ISO_C_VISIBLE >= 1999
#define va_copy(dest, src) \
__builtin_va_copy((dest), (src))
#endif
#define va_end(ap) \
__builtin_va_end(ap)
@ -127,13 +133,15 @@ typedef __va_list va_list;
#define va_end(ap)
#if __ISO_C_VISIBLE >= 1999
#if !defined(_ANSI_SOURCE) && \
(!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) || \
defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L)
#define va_copy(dest, src) \
((dest) = (src))
#endif
#endif
#endif /* __GNUC__ post GCC 2.95 */
#endif /* _POWERPC_STDARG_H_ */
#endif /* _MACHINE_STDARG_H_ */

View File

@ -41,9 +41,13 @@
#ifndef _MACHINE_STDARG_H_
#define _MACHINE_STDARG_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
#ifndef _VA_LIST_DECLARED
#define _VA_LIST_DECLARED
typedef __va_list va_list;
#endif
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
@ -53,8 +57,10 @@ typedef __va_list va_list;
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
#if __ISO_C_VISIBLE >= 1999
#define va_copy(dest, src) \
__builtin_va_copy((dest), (src))
#endif
#define va_end(ap) \
__builtin_va_end(ap)