summaryrefslogtreecommitdiff
path: root/devel/wasi-libc/files/stdarg.h
diff options
context:
space:
mode:
authorMikael Urankar <mikael@FreeBSD.org>2020-11-02 15:58:27 +0000
committerMikael Urankar <mikael@FreeBSD.org>2020-11-02 15:58:27 +0000
commite7dcca1066f9417a15e401e7a979f62aa922f82a (patch)
treeebb6a5607dff103d3a61ee6e46fa6c80d72d4792 /devel/wasi-libc/files/stdarg.h
parentwww/rt50: fix bad plist substitution (diff)
devel/wasi-compiler-rt11, wasi-libc, wasi-libcxx: New ports for WebAssembly System Interface (WASI) libc, clang builtins (compiler-rt), libc++, libcxxabi
WASI is a "syscall" interface for WebAssembly, significantly inspired by CloudABI. It is supported in clang 8 and up, but to actually build C programs, it needs clang builtins and the libc/sysroot. And for C++, also libc++ and libcxxabi. Submitted by: Greg V <greg%unrelenting.technology> Differential Revision: https://reviews.freebsd.org/D22960
Diffstat (limited to 'devel/wasi-libc/files/stdarg.h')
-rw-r--r--devel/wasi-libc/files/stdarg.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/devel/wasi-libc/files/stdarg.h b/devel/wasi-libc/files/stdarg.h
new file mode 100644
index 000000000000..0bc39408c1e5
--- /dev/null
+++ b/devel/wasi-libc/files/stdarg.h
@@ -0,0 +1,35 @@
+/*===---- stdarg.h - Variable argument handling ----------------------------===
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#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)
+
+/* 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)
+#endif
+
+#ifndef __GNUC_VA_LIST
+#define __GNUC_VA_LIST 1
+typedef __builtin_va_list __gnuc_va_list;
+#endif
+
+#endif /* __STDARG_H */