1193326Sed/*===---- stdarg.h - Variable argument handling ----------------------------===
2193326Sed *
3193326Sed * Copyright (c) 2008 Eli Friedman
4193326Sed *
5193326Sed * Permission is hereby granted, free of charge, to any person obtaining a copy
6193326Sed * of this software and associated documentation files (the "Software"), to deal
7193326Sed * in the Software without restriction, including without limitation the rights
8193326Sed * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9193326Sed * copies of the Software, and to permit persons to whom the Software is
10193326Sed * furnished to do so, subject to the following conditions:
11193326Sed *
12193326Sed * The above copyright notice and this permission notice shall be included in
13193326Sed * all copies or substantial portions of the Software.
14193326Sed *
15193326Sed * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16193326Sed * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17193326Sed * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18193326Sed * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19193326Sed * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20193326Sed * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21193326Sed * THE SOFTWARE.
22193326Sed *
23193326Sed *===-----------------------------------------------------------------------===
24193326Sed */
25193326Sed
26193326Sed#ifndef __STDARG_H
27193326Sed#define __STDARG_H
28193326Sed
29204962Srdivacky#ifndef _VA_LIST
30193326Sedtypedef __builtin_va_list va_list;
31204962Srdivacky#define _VA_LIST
32204962Srdivacky#endif
33193326Sed#define va_start(ap, param) __builtin_va_start(ap, param)
34193326Sed#define va_end(ap)          __builtin_va_end(ap)
35193326Sed#define va_arg(ap, type)    __builtin_va_arg(ap, type)
36193326Sed
37193326Sed/* GCC always defines __va_copy, but does not define va_copy unless in c99 mode
38193326Sed * or -ansi is not specified, since it was not part of C90.
39193326Sed */
40198092Srdivacky#define __va_copy(d,s) __builtin_va_copy(d,s)
41193326Sed
42224145Sdim#if __STDC_VERSION__ >= 199900L || __cplusplus >= 201103L || !defined(__STRICT_ANSI__)
43193326Sed#define va_copy(dest, src)  __builtin_va_copy(dest, src)
44193326Sed#endif
45193326Sed
46193326Sed/* Hack required to make standard headers work, at least on Ubuntu */
47193326Sed#define __GNUC_VA_LIST 1
48193326Sedtypedef __builtin_va_list __gnuc_va_list;
49193326Sed
50193326Sed#endif /* __STDARG_H */
51