xref: /xnu-8796.121.2/EXTERNAL_HEADERS/stdarg.h (revision c54f35ca767986246321eb901baf8f5ff7923f6a)
1*c54f35caSApple OSS Distributions /*===---- stdarg.h - Variable argument handling ----------------------------===
2*c54f35caSApple OSS Distributions  *
3*c54f35caSApple OSS Distributions  * Copyright (c) 2008 Eli Friedman
4*c54f35caSApple OSS Distributions  *
5*c54f35caSApple OSS Distributions  * Permission is hereby granted, free of charge, to any person obtaining a copy
6*c54f35caSApple OSS Distributions  * of this software and associated documentation files (the "Software"), to deal
7*c54f35caSApple OSS Distributions  * in the Software without restriction, including without limitation the rights
8*c54f35caSApple OSS Distributions  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9*c54f35caSApple OSS Distributions  * copies of the Software, and to permit persons to whom the Software is
10*c54f35caSApple OSS Distributions  * furnished to do so, subject to the following conditions:
11*c54f35caSApple OSS Distributions  *
12*c54f35caSApple OSS Distributions  * The above copyright notice and this permission notice shall be included in
13*c54f35caSApple OSS Distributions  * all copies or substantial portions of the Software.
14*c54f35caSApple OSS Distributions  *
15*c54f35caSApple OSS Distributions  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16*c54f35caSApple OSS Distributions  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17*c54f35caSApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18*c54f35caSApple OSS Distributions  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19*c54f35caSApple OSS Distributions  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20*c54f35caSApple OSS Distributions  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21*c54f35caSApple OSS Distributions  * THE SOFTWARE.
22*c54f35caSApple OSS Distributions  *
23*c54f35caSApple OSS Distributions  *===-----------------------------------------------------------------------===
24*c54f35caSApple OSS Distributions  */
25*c54f35caSApple OSS Distributions 
26*c54f35caSApple OSS Distributions #ifndef __STDARG_H
27*c54f35caSApple OSS Distributions #define __STDARG_H
28*c54f35caSApple OSS Distributions 
29*c54f35caSApple OSS Distributions #ifndef _VA_LIST
30*c54f35caSApple OSS Distributions typedef __builtin_va_list va_list;
31*c54f35caSApple OSS Distributions #define _VA_LIST
32*c54f35caSApple OSS Distributions #endif
33*c54f35caSApple OSS Distributions #define va_start(ap, param) __builtin_va_start(ap, param)
34*c54f35caSApple OSS Distributions #define va_end(ap)          __builtin_va_end(ap)
35*c54f35caSApple OSS Distributions #define va_arg(ap, type)    __builtin_va_arg(ap, type)
36*c54f35caSApple OSS Distributions 
37*c54f35caSApple OSS Distributions /* GCC always defines __va_copy, but does not define va_copy unless in c99 mode
38*c54f35caSApple OSS Distributions  * or -ansi is not specified, since it was not part of C90.
39*c54f35caSApple OSS Distributions  */
40*c54f35caSApple OSS Distributions #define __va_copy(d,s) __builtin_va_copy(d,s)
41*c54f35caSApple OSS Distributions 
42*c54f35caSApple OSS Distributions #if __STDC_VERSION__ >= 199900L || __cplusplus >= 201103L || !defined(__STRICT_ANSI__)
43*c54f35caSApple OSS Distributions #define va_copy(dest, src)  __builtin_va_copy(dest, src)
44*c54f35caSApple OSS Distributions #endif
45*c54f35caSApple OSS Distributions 
46*c54f35caSApple OSS Distributions /* Hack required to make standard headers work, at least on Ubuntu */
47*c54f35caSApple OSS Distributions #define __GNUC_VA_LIST 1
48*c54f35caSApple OSS Distributions typedef __builtin_va_list __gnuc_va_list;
49*c54f35caSApple OSS Distributions 
50*c54f35caSApple OSS Distributions #endif /* __STDARG_H */
51