xref: /freebsd/contrib/llvm-project/clang/lib/Headers/stdarg.h (revision 36b606ae6aa4b24061096ba18582e0a08ccd5dba)
1 /*===---- stdarg.h - Variable argument handling ----------------------------===
2  *
3  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4  * See https://llvm.org/LICENSE.txt for license information.
5  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6  *
7  *===-----------------------------------------------------------------------===
8  */
9 
10 /*
11  * This header is designed to be included multiple times. If any of the __need_
12  * macros are defined, then only that subset of interfaces are provided. This
13  * can be useful for POSIX headers that need to not expose all of stdarg.h, but
14  * need to use some of its interfaces. Otherwise this header provides all of
15  * the expected interfaces.
16  *
17  * When clang modules are enabled, this header is a textual header to support
18  * the multiple include behavior. As such, it doesn't directly declare anything
19  * so that it doesn't add duplicate declarations to all of its includers'
20  * modules.
21  */
22 #if defined(__MVS__) && __has_include_next(<stdarg.h>)
23 #undef __need___va_list
24 #undef __need_va_list
25 #undef __need_va_arg
26 #undef __need___va_copy
27 #undef __need_va_copy
28 #include <__stdarg_header_macro.h>
29 #include_next <stdarg.h>
30 
31 #else
32 #if !defined(__need___va_list) && !defined(__need_va_list) &&                  \
33     !defined(__need_va_arg) && !defined(__need___va_copy) &&                   \
34     !defined(__need_va_copy)
35 #define __need___va_list
36 #define __need_va_list
37 #define __need_va_arg
38 #define __need___va_copy
39 /* GCC always defines __va_copy, but does not define va_copy unless in c99 mode
40  * or -ansi is not specified, since it was not part of C90.
41  */
42 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) ||              \
43     (defined(__cplusplus) && __cplusplus >= 201103L) ||                        \
44     !defined(__STRICT_ANSI__)
45 #define __need_va_copy
46 #endif
47 #include <__stdarg_header_macro.h>
48 #endif
49 
50 #ifdef __need___va_list
51 #include <__stdarg___gnuc_va_list.h>
52 #undef __need___va_list
53 #endif /* defined(__need___va_list) */
54 
55 #ifdef __need_va_list
56 #include <__stdarg_va_list.h>
57 #undef __need_va_list
58 #endif /* defined(__need_va_list) */
59 
60 #ifdef __need_va_arg
61 #include <__stdarg_va_arg.h>
62 #undef __need_va_arg
63 #endif /* defined(__need_va_arg) */
64 
65 #ifdef __need___va_copy
66 #include <__stdarg___va_copy.h>
67 #undef __need___va_copy
68 #endif /* defined(__need___va_copy) */
69 
70 #ifdef __need_va_copy
71 #include <__stdarg_va_copy.h>
72 #undef __need_va_copy
73 #endif /* defined(__need_va_copy) */
74 
75 #endif /* __MVS__ */
76