diff options
Diffstat (limited to 'contrib/llvm-project/clang/lib/Headers/stdarg.h')
-rw-r--r-- | contrib/llvm-project/clang/lib/Headers/stdarg.h | 78 |
1 files changed, 59 insertions, 19 deletions
diff --git a/contrib/llvm-project/clang/lib/Headers/stdarg.h b/contrib/llvm-project/clang/lib/Headers/stdarg.h index 0bc39408c1e5..6203d7a600a2 100644 --- a/contrib/llvm-project/clang/lib/Headers/stdarg.h +++ b/contrib/llvm-project/clang/lib/Headers/stdarg.h @@ -7,29 +7,69 @@ *===-----------------------------------------------------------------------=== */ -#ifndef __STDARG_H -#define __STDARG_H - -#ifndef _VA_LIST -typedef __builtin_va_list va_list; -#define _VA_LIST -#endif -#define va_start(ap, param) __builtin_va_start(ap, param) -#define va_end(ap) __builtin_va_end(ap) -#define va_arg(ap, type) __builtin_va_arg(ap, type) +/* + * This header is designed to be included multiple times. If any of the __need_ + * macros are defined, then only that subset of interfaces are provided. This + * can be useful for POSIX headers that need to not expose all of stdarg.h, but + * need to use some of its interfaces. Otherwise this header provides all of + * the expected interfaces. + * + * When clang modules are enabled, this header is a textual header to support + * the multiple include behavior. As such, it doesn't directly declare anything + * so that it doesn't add duplicate declarations to all of its includers' + * modules. + */ +#if defined(__MVS__) && __has_include_next(<stdarg.h>) +#undef __need___va_list +#undef __need_va_list +#undef __need_va_arg +#undef __need___va_copy +#undef __need_va_copy +#include <__stdarg_header_macro.h> +#include_next <stdarg.h> +#else +#if !defined(__need___va_list) && !defined(__need_va_list) && \ + !defined(__need_va_arg) && !defined(__need___va_copy) && \ + !defined(__need_va_copy) +#define __need___va_list +#define __need_va_list +#define __need_va_arg +#define __need___va_copy /* GCC always defines __va_copy, but does not define va_copy unless in c99 mode * or -ansi is not specified, since it was not part of C90. */ -#define __va_copy(d,s) __builtin_va_copy(d,s) - -#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L || !defined(__STRICT_ANSI__) -#define va_copy(dest, src) __builtin_va_copy(dest, src) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ + (defined(__cplusplus) && __cplusplus >= 201103L) || \ + !defined(__STRICT_ANSI__) +#define __need_va_copy #endif - -#ifndef __GNUC_VA_LIST -#define __GNUC_VA_LIST 1 -typedef __builtin_va_list __gnuc_va_list; +#include <__stdarg_header_macro.h> #endif -#endif /* __STDARG_H */ +#ifdef __need___va_list +#include <__stdarg___gnuc_va_list.h> +#undef __need___va_list +#endif /* defined(__need___va_list) */ + +#ifdef __need_va_list +#include <__stdarg_va_list.h> +#undef __need_va_list +#endif /* defined(__need_va_list) */ + +#ifdef __need_va_arg +#include <__stdarg_va_arg.h> +#undef __need_va_arg +#endif /* defined(__need_va_arg) */ + +#ifdef __need___va_copy +#include <__stdarg___va_copy.h> +#undef __need___va_copy +#endif /* defined(__need___va_copy) */ + +#ifdef __need_va_copy +#include <__stdarg_va_copy.h> +#undef __need_va_copy +#endif /* defined(__need_va_copy) */ + +#endif /* __MVS__ */ |