From nobody Wed Mar 27 18:57:31 2024 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4V4bWw078cz5BJ2C; Wed, 27 Mar 2024 18:57:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V4bWv6z2Mz4bRN; Wed, 27 Mar 2024 18:57:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711565851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kwgBhyG8+olwJD1dvj/OwC0lr6BnOdQU3PIhKLSpi0Y=; b=BLeKcGkkEmWFsqOa1h7Mo9dSBxHo0Dcv9dmY0VHq0c7d1R/Jz9spUS2RtyR3cTN6qqRWXP SJizvKF40xI++MDMf/ABXlaXklOmwD8TZcDxTNHNxuAUsr/MKRu0Z+48w3C7NUeD0fK41U Lzt4s367KIy8n62rTKQpAPSEsV7JXv2M4Eb5RRHRwJwb42Wm0kMqrdB1yANnpfgxBPrOeT szJ2qAlVA3PasDgjg5EVUdlIXow5eGypzAYomIdiAJdr0C9lR2/Mrac4jujEMNdYPzpUW5 jAiiZiNOubT8U3JBERFnHJEWJcJjEGXI0I6CVsjK8WFW2yM3I+7/L7lB564RlA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711565851; a=rsa-sha256; cv=none; b=procr6diUd6b/ge15N7EgUBpAM0nIrBVwK2I2oMTrkPP8K50ABvzmMh92kKFA6dImRcnax tBQAMOKpK5ioDK9hdy981xcom8AUHlMGG9I+NlwItDhdf4QVFIKukSVyyYV8oVcIKLl6s5 maKvKbc2rNeIrYsrtQf+0vMaonhj0DGBCi+aZ6lye73xdvTVkFpaO11wybOClrgfYCRgyU hcCcFnFtmf4nxAqMJFwvTTiICw3/FEChTDWCRFB4f/syufrSV57JOJfcjai/+GOeBWiQ3A laVQ8tGqpTqW0mu26nB136uyzGTougxSPaaMHjB0WN0NKlOfm5XCMUkfu5RJcw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711565851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kwgBhyG8+olwJD1dvj/OwC0lr6BnOdQU3PIhKLSpi0Y=; b=CtyeLDpgt0waFJq2Tvim3hFzeuNU8ADzacbVNr992dcsvL2o3KZFvi8qwZb59jPlNAS5KK KfnNaY8q0G7HS8pHo6YFCCGJqrHN5G3xxdh9buMz2V3KkBOsyE5j4c8XqvshZ0uVW2PMv9 870Xnicvn4ZOENyT/YK6ZTpXfp/cKpD7K9N7EtkvRhNusMtayVibRBE4yK+3L+RXAEdcK4 jojBYh8nwQKfDxB48G9V5bVD1AGjFYYTmxdBHDbKFoVmem4QG2ngrb311CQTxeueCz3I4g 776WEvDMymraPXrKpQx0ByJLr9rqt14CexCkw75vahgxh4bPJ4T7JIz2cKsgtA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4V4bWv6Z3czvJS; Wed, 27 Mar 2024 18:57:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 42RIvVgJ064815; Wed, 27 Mar 2024 18:57:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42RIvVog064812; Wed, 27 Mar 2024 18:57:31 GMT (envelope-from git) Date: Wed, 27 Mar 2024 18:57:31 GMT Message-Id: <202403271857.42RIvVog064812@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Charlie Li Subject: git: b787213d5b8c - main - devel/wasi-libc: refresh std{arg,def} headers from LLVM 18 List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vishwin X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b787213d5b8c215a84ded51af10cccffc269d754 Auto-Submitted: auto-generated The branch main has been updated by vishwin: URL: https://cgit.FreeBSD.org/ports/commit/?id=b787213d5b8c215a84ded51af10cccffc269d754 commit b787213d5b8c215a84ded51af10cccffc269d754 Author: Charlie Li AuthorDate: 2024-03-27 18:50:49 +0000 Commit: Charlie Li CommitDate: 2024-03-27 18:57:22 +0000 devel/wasi-libc: refresh std{arg,def} headers from LLVM 18 --- devel/wasi-libc/Makefile | 11 +- devel/wasi-libc/files/__stdarg___gnuc_va_list.h | 13 ++ devel/wasi-libc/files/__stdarg___va_copy.h | 12 ++ devel/wasi-libc/files/__stdarg_va_arg.h | 22 ++++ devel/wasi-libc/files/__stdarg_va_copy.h | 12 ++ devel/wasi-libc/files/__stdarg_va_list.h | 13 ++ devel/wasi-libc/files/__stddef_max_align_t.h | 27 ++++ devel/wasi-libc/files/__stddef_null.h | 29 +++++ devel/wasi-libc/files/__stddef_nullptr_t.h | 29 +++++ devel/wasi-libc/files/__stddef_offsetof.h | 17 +++ devel/wasi-libc/files/__stddef_ptrdiff_t.h | 20 +++ devel/wasi-libc/files/__stddef_rsize_t.h | 20 +++ devel/wasi-libc/files/__stddef_size_t.h | 20 +++ devel/wasi-libc/files/__stddef_unreachable.h | 17 +++ devel/wasi-libc/files/__stddef_wchar_t.h | 28 +++++ devel/wasi-libc/files/__stddef_wint_t.h | 15 +++ devel/wasi-libc/files/stdarg.h | 82 +++++++++--- devel/wasi-libc/files/stddef.h | 158 ++++++++++++------------ devel/wasi-libc/pkg-plist | 15 +++ 19 files changed, 458 insertions(+), 102 deletions(-) diff --git a/devel/wasi-libc/Makefile b/devel/wasi-libc/Makefile index 32770ed0b0ae..b93e1e6c5e34 100644 --- a/devel/wasi-libc/Makefile +++ b/devel/wasi-libc/Makefile @@ -1,6 +1,7 @@ PORTNAME= wasi-libc DISTVERSIONPREFIX= wasi-sdk- DISTVERSION= 21 +PORTREVISION= 1 CATEGORIES= devel MAINTAINER= vishwin@FreeBSD.org @@ -26,9 +27,6 @@ ALL_TARGET= finish # NOTE: matches the https://github.com/WebAssembly/wasi-sdk WASI_SYSROOT= ${PREFIX}/share/wasi-sysroot -# NOTE: our llvm ports don't ship stdarg/stddef clang headers, so they're in FILESDIR -# and we install them to the sysroot - MAKE_ENV= INSTALL_DIR=${STAGEDIR}${WASI_SYSROOT} \ EXTRA_CFLAGS="-O2 -DNDEBUG -isystem ${FILESDIR}" \ AR=${LOCALBASE}/bin/llvm-ar${LLVM_VERSION} \ @@ -40,7 +38,10 @@ post-patch: ${REINPLACE_CMD} -e 's|install: finish|install:|' ${WRKSRC}/Makefile post-install: - ${INSTALL_DATA} ${FILESDIR}/stdarg.h ${STAGEDIR}${WASI_SYSROOT}/include/ - ${INSTALL_DATA} ${FILESDIR}/stddef.h ${STAGEDIR}${WASI_SYSROOT}/include/ +# NOTE: our llvm ports don't ship stdarg/stddef clang headers, so +# they are copied from clang/lib/Headers into FILESDIR and we install +# them to the sysroot + ${INSTALL_DATA} ${FILESDIR}/*stdarg*.h ${STAGEDIR}${WASI_SYSROOT}/include/ + ${INSTALL_DATA} ${FILESDIR}/*stddef*.h ${STAGEDIR}${WASI_SYSROOT}/include/ .include diff --git a/devel/wasi-libc/files/__stdarg___gnuc_va_list.h b/devel/wasi-libc/files/__stdarg___gnuc_va_list.h new file mode 100644 index 000000000000..2a0a7e8cc6c0 --- /dev/null +++ b/devel/wasi-libc/files/__stdarg___gnuc_va_list.h @@ -0,0 +1,13 @@ +/*===---- __stdarg___gnuc_va_list.h - Definition of __gnuc_va_list ---------=== + * + * 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 __GNUC_VA_LIST +#define __GNUC_VA_LIST +typedef __builtin_va_list __gnuc_va_list; +#endif diff --git a/devel/wasi-libc/files/__stdarg___va_copy.h b/devel/wasi-libc/files/__stdarg___va_copy.h new file mode 100644 index 000000000000..e433e18a7082 --- /dev/null +++ b/devel/wasi-libc/files/__stdarg___va_copy.h @@ -0,0 +1,12 @@ +/*===---- __stdarg___va_copy.h - Definition of __va_copy -------------------=== + * + * 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 __va_copy +#define __va_copy(d, s) __builtin_va_copy(d, s) +#endif diff --git a/devel/wasi-libc/files/__stdarg_va_arg.h b/devel/wasi-libc/files/__stdarg_va_arg.h new file mode 100644 index 000000000000..89bd2f65d3be --- /dev/null +++ b/devel/wasi-libc/files/__stdarg_va_arg.h @@ -0,0 +1,22 @@ +/*===---- __stdarg_va_arg.h - Definitions of va_start, va_arg, va_end-------=== + * + * 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 va_arg + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +/* C23 does not require the second parameter for va_start. */ +#define va_start(ap, ...) __builtin_va_start(ap, 0) +#else +/* Versions before C23 do require the second parameter. */ +#define va_start(ap, param) __builtin_va_start(ap, param) +#endif +#define va_end(ap) __builtin_va_end(ap) +#define va_arg(ap, type) __builtin_va_arg(ap, type) + +#endif diff --git a/devel/wasi-libc/files/__stdarg_va_copy.h b/devel/wasi-libc/files/__stdarg_va_copy.h new file mode 100644 index 000000000000..8645328c2c68 --- /dev/null +++ b/devel/wasi-libc/files/__stdarg_va_copy.h @@ -0,0 +1,12 @@ +/*===---- __stdarg_va_copy.h - Definition of va_copy------------------------=== + * + * 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 va_copy +#define va_copy(dest, src) __builtin_va_copy(dest, src) +#endif diff --git a/devel/wasi-libc/files/__stdarg_va_list.h b/devel/wasi-libc/files/__stdarg_va_list.h new file mode 100644 index 000000000000..20c2e2cad940 --- /dev/null +++ b/devel/wasi-libc/files/__stdarg_va_list.h @@ -0,0 +1,13 @@ +/*===---- __stdarg_va_list.h - Definition of va_list -----------------------=== + * + * 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 _VA_LIST +#define _VA_LIST +typedef __builtin_va_list va_list; +#endif diff --git a/devel/wasi-libc/files/__stddef_max_align_t.h b/devel/wasi-libc/files/__stddef_max_align_t.h new file mode 100644 index 000000000000..512606a87728 --- /dev/null +++ b/devel/wasi-libc/files/__stddef_max_align_t.h @@ -0,0 +1,27 @@ +/*===---- __stddef_max_align_t.h - Definition of max_align_t ---------------=== + * + * 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 __CLANG_MAX_ALIGN_T_DEFINED +#define __CLANG_MAX_ALIGN_T_DEFINED + +#if defined(_MSC_VER) +typedef double max_align_t; +#elif defined(__APPLE__) +typedef long double max_align_t; +#else +// Define 'max_align_t' to match the GCC definition. +typedef struct { + long long __clang_max_align_nonce1 + __attribute__((__aligned__(__alignof__(long long)))); + long double __clang_max_align_nonce2 + __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +#endif + +#endif diff --git a/devel/wasi-libc/files/__stddef_null.h b/devel/wasi-libc/files/__stddef_null.h new file mode 100644 index 000000000000..c10bd2d7d988 --- /dev/null +++ b/devel/wasi-libc/files/__stddef_null.h @@ -0,0 +1,29 @@ +/*===---- __stddef_null.h - Definition of NULL -----------------------------=== + * + * 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 + * + *===-----------------------------------------------------------------------=== + */ + +#if !defined(NULL) || !__building_module(_Builtin_stddef) + +/* linux/stddef.h will define NULL to 0. glibc (and other) headers then define + * __need_NULL and rely on stddef.h to redefine NULL to the correct value again. + * Modules don't support redefining macros like that, but support that pattern + * in the non-modules case. + */ +#undef NULL + +#ifdef __cplusplus +#if !defined(__MINGW32__) && !defined(_MSC_VER) +#define NULL __null +#else +#define NULL 0 +#endif +#else +#define NULL ((void*)0) +#endif + +#endif diff --git a/devel/wasi-libc/files/__stddef_nullptr_t.h b/devel/wasi-libc/files/__stddef_nullptr_t.h new file mode 100644 index 000000000000..7f3fbe6fe0d3 --- /dev/null +++ b/devel/wasi-libc/files/__stddef_nullptr_t.h @@ -0,0 +1,29 @@ +/*===---- __stddef_nullptr_t.h - Definition of nullptr_t -------------------=== + * + * 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 + * + *===-----------------------------------------------------------------------=== + */ + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(_NULLPTR_T) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define _NULLPTR_T + +#ifdef __cplusplus +#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED) +namespace std { +typedef decltype(nullptr) nullptr_t; +} +using ::std::nullptr_t; +#endif +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +typedef typeof(nullptr) nullptr_t; +#endif + +#endif diff --git a/devel/wasi-libc/files/__stddef_offsetof.h b/devel/wasi-libc/files/__stddef_offsetof.h new file mode 100644 index 000000000000..84172c6cd273 --- /dev/null +++ b/devel/wasi-libc/files/__stddef_offsetof.h @@ -0,0 +1,17 @@ +/*===---- __stddef_offsetof.h - Definition of offsetof ---------------------=== + * + * 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 + * + *===-----------------------------------------------------------------------=== + */ + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(offsetof) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define offsetof(t, d) __builtin_offsetof(t, d) +#endif diff --git a/devel/wasi-libc/files/__stddef_ptrdiff_t.h b/devel/wasi-libc/files/__stddef_ptrdiff_t.h new file mode 100644 index 000000000000..fd3c893c66c9 --- /dev/null +++ b/devel/wasi-libc/files/__stddef_ptrdiff_t.h @@ -0,0 +1,20 @@ +/*===---- __stddef_ptrdiff_t.h - Definition of ptrdiff_t -------------------=== + * + * 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 + * + *===-----------------------------------------------------------------------=== + */ + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(_PTRDIFF_T) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define _PTRDIFF_T + +typedef __PTRDIFF_TYPE__ ptrdiff_t; + +#endif diff --git a/devel/wasi-libc/files/__stddef_rsize_t.h b/devel/wasi-libc/files/__stddef_rsize_t.h new file mode 100644 index 000000000000..dd433d40d973 --- /dev/null +++ b/devel/wasi-libc/files/__stddef_rsize_t.h @@ -0,0 +1,20 @@ +/*===---- __stddef_rsize_t.h - Definition of rsize_t -----------------------=== + * + * 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 + * + *===-----------------------------------------------------------------------=== + */ + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(_RSIZE_T) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define _RSIZE_T + +typedef __SIZE_TYPE__ rsize_t; + +#endif diff --git a/devel/wasi-libc/files/__stddef_size_t.h b/devel/wasi-libc/files/__stddef_size_t.h new file mode 100644 index 000000000000..3dd7b1f37929 --- /dev/null +++ b/devel/wasi-libc/files/__stddef_size_t.h @@ -0,0 +1,20 @@ +/*===---- __stddef_size_t.h - Definition of size_t -------------------------=== + * + * 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 + * + *===-----------------------------------------------------------------------=== + */ + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(_SIZE_T) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define _SIZE_T + +typedef __SIZE_TYPE__ size_t; + +#endif diff --git a/devel/wasi-libc/files/__stddef_unreachable.h b/devel/wasi-libc/files/__stddef_unreachable.h new file mode 100644 index 000000000000..518580c92d3f --- /dev/null +++ b/devel/wasi-libc/files/__stddef_unreachable.h @@ -0,0 +1,17 @@ +/*===---- __stddef_unreachable.h - Definition of unreachable ---------------=== + * + * 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 + * + *===-----------------------------------------------------------------------=== + */ + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(unreachable) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define unreachable() __builtin_unreachable() +#endif diff --git a/devel/wasi-libc/files/__stddef_wchar_t.h b/devel/wasi-libc/files/__stddef_wchar_t.h new file mode 100644 index 000000000000..bd69f6322541 --- /dev/null +++ b/devel/wasi-libc/files/__stddef_wchar_t.h @@ -0,0 +1,28 @@ +/*===---- __stddef_wchar.h - Definition of wchar_t -------------------------=== + * + * 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 + * + *===-----------------------------------------------------------------------=== + */ + +#if !defined(__cplusplus) || (defined(_MSC_VER) && !_NATIVE_WCHAR_T_DEFINED) + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(_WCHAR_T) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define _WCHAR_T + +#ifdef _MSC_EXTENSIONS +#define _WCHAR_T_DEFINED +#endif + +typedef __WCHAR_TYPE__ wchar_t; + +#endif + +#endif diff --git a/devel/wasi-libc/files/__stddef_wint_t.h b/devel/wasi-libc/files/__stddef_wint_t.h new file mode 100644 index 000000000000..0aa291507957 --- /dev/null +++ b/devel/wasi-libc/files/__stddef_wint_t.h @@ -0,0 +1,15 @@ +/*===---- __stddef_wint.h - Definition of wint_t ---------------------------=== + * + * 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 _WINT_T +#define _WINT_T + +typedef __WINT_TYPE__ wint_t; + +#endif diff --git a/devel/wasi-libc/files/stdarg.h b/devel/wasi-libc/files/stdarg.h index 0bc39408c1e5..94b066566f08 100644 --- a/devel/wasi-libc/files/stdarg.h +++ b/devel/wasi-libc/files/stdarg.h @@ -7,29 +7,73 @@ *===-----------------------------------------------------------------------=== */ -#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. It ignores + * its header guard so that multiple submodules can export its interfaces. + * Take module SM with submodules A and B, whose headers both include stdarg.h + * When SM.A builds, __STDARG_H will be defined. When SM.B builds, the + * definition from SM.A will leak when building without local submodule + * visibility. stdarg.h wouldn't include any of its implementation headers, and + * SM.B wouldn't import any of the stdarg modules, and SM.B's `export *` + * wouldn't export any stdarg interfaces as expected. However, since stdarg.h + * ignores its header guard when building with modules, it all works as + * expected. + * + * When clang modules are not enabled, the header guards can function in the + * normal simple fashion. + */ +#if !defined(__STDARG_H) || __has_feature(modules) || \ + defined(__need___va_list) || defined(__need_va_list) || \ + defined(__need_va_arg) || defined(__need___va_copy) || \ + defined(__need_va_copy) +#if !defined(__need___va_list) && !defined(__need_va_list) && \ + !defined(__need_va_arg) && !defined(__need___va_copy) && \ + !defined(__need_va_copy) +#define __STDARG_H +#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; #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 diff --git a/devel/wasi-libc/files/stddef.h b/devel/wasi-libc/files/stddef.h index 15acd4427ca1..e0ad7b8d17af 100644 --- a/devel/wasi-libc/files/stddef.h +++ b/devel/wasi-libc/files/stddef.h @@ -7,114 +7,116 @@ *===-----------------------------------------------------------------------=== */ -#if !defined(__STDDEF_H) || defined(__need_ptrdiff_t) || \ - defined(__need_size_t) || defined(__need_wchar_t) || \ - defined(__need_NULL) || defined(__need_wint_t) +/* + * 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 stddef.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. It ignores + * its header guard so that multiple submodules can export its interfaces. + * Take module SM with submodules A and B, whose headers both include stddef.h + * When SM.A builds, __STDDEF_H will be defined. When SM.B builds, the + * definition from SM.A will leak when building without local submodule + * visibility. stddef.h wouldn't include any of its implementation headers, and + * SM.B wouldn't import any of the stddef modules, and SM.B's `export *` + * wouldn't export any stddef interfaces as expected. However, since stddef.h + * ignores its header guard when building with modules, it all works as + * expected. + * + * When clang modules are not enabled, the header guards can function in the + * normal simple fashion. + */ +#if !defined(__STDDEF_H) || __has_feature(modules) || \ + (defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1) || \ + defined(__need_ptrdiff_t) || defined(__need_size_t) || \ + defined(__need_rsize_t) || defined(__need_wchar_t) || \ + defined(__need_NULL) || defined(__need_nullptr_t) || \ + defined(__need_unreachable) || defined(__need_max_align_t) || \ + defined(__need_offsetof) || defined(__need_wint_t) #if !defined(__need_ptrdiff_t) && !defined(__need_size_t) && \ - !defined(__need_wchar_t) && !defined(__need_NULL) && \ - !defined(__need_wint_t) -/* Always define miscellaneous pieces when modules are available. */ -#if !__has_feature(modules) + !defined(__need_rsize_t) && !defined(__need_wchar_t) && \ + !defined(__need_NULL) && !defined(__need_nullptr_t) && \ + !defined(__need_unreachable) && !defined(__need_max_align_t) && \ + !defined(__need_offsetof) && !defined(__need_wint_t) #define __STDDEF_H -#endif #define __need_ptrdiff_t #define __need_size_t +/* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is + * enabled. */ +#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 +#define __need_rsize_t +#endif #define __need_wchar_t #define __need_NULL -#define __need_STDDEF_H_misc -/* __need_wint_t is intentionally not defined here. */ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \ + defined(__cplusplus) +#define __need_nullptr_t #endif - -#if defined(__need_ptrdiff_t) -#if !defined(_PTRDIFF_T) || __has_feature(modules) -/* Always define ptrdiff_t when modules are available. */ -#if !__has_feature(modules) -#define _PTRDIFF_T +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +#define __need_unreachable +#endif +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ + (defined(__cplusplus) && __cplusplus >= 201103L) +#define __need_max_align_t #endif -typedef __PTRDIFF_TYPE__ ptrdiff_t; +#define __need_offsetof +/* wint_t is provided by and not . It's here + * for compatibility, but must be explicitly requested. Therefore + * __need_wint_t is intentionally not defined here. */ #endif + +#if defined(__need_ptrdiff_t) +#include <__stddef_ptrdiff_t.h> #undef __need_ptrdiff_t #endif /* defined(__need_ptrdiff_t) */ #if defined(__need_size_t) -#if !defined(_SIZE_T) || __has_feature(modules) -/* Always define size_t when modules are available. */ -#if !__has_feature(modules) -#define _SIZE_T -#endif -typedef __SIZE_TYPE__ size_t; -#endif +#include <__stddef_size_t.h> #undef __need_size_t #endif /*defined(__need_size_t) */ -#if defined(__need_STDDEF_H_misc) -/* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is - * enabled. */ -#if (defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 && \ - !defined(_RSIZE_T)) || __has_feature(modules) -/* Always define rsize_t when modules are available. */ -#if !__has_feature(modules) -#define _RSIZE_T -#endif -typedef __SIZE_TYPE__ rsize_t; -#endif -#endif /* defined(__need_STDDEF_H_misc) */ +#if defined(__need_rsize_t) +#include <__stddef_rsize_t.h> +#undef __need_rsize_t +#endif /* defined(__need_rsize_t) */ #if defined(__need_wchar_t) -#ifndef __cplusplus -/* Always define wchar_t when modules are available. */ -#if !defined(_WCHAR_T) || __has_feature(modules) -#if !__has_feature(modules) -#define _WCHAR_T -#if defined(_MSC_EXTENSIONS) -#define _WCHAR_T_DEFINED -#endif -#endif -typedef __WCHAR_TYPE__ wchar_t; -#endif -#endif +#include <__stddef_wchar_t.h> #undef __need_wchar_t #endif /* defined(__need_wchar_t) */ #if defined(__need_NULL) -#undef NULL -#ifdef __cplusplus -# if !defined(__MINGW32__) && !defined(_MSC_VER) -# define NULL __null -# else -# define NULL 0 -# endif -#else -# define NULL ((void*)0) -#endif -#ifdef __cplusplus -#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED) -namespace std { typedef decltype(nullptr) nullptr_t; } -using ::std::nullptr_t; -#endif -#endif +#include <__stddef_null.h> #undef __need_NULL #endif /* defined(__need_NULL) */ -#if defined(__need_STDDEF_H_misc) -#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L -#include "__stddef_max_align_t.h" -#endif -#define offsetof(t, d) __builtin_offsetof(t, d) -#undef __need_STDDEF_H_misc -#endif /* defined(__need_STDDEF_H_misc) */ +#if defined(__need_nullptr_t) +#include <__stddef_nullptr_t.h> +#undef __need_nullptr_t +#endif /* defined(__need_nullptr_t) */ + +#if defined(__need_unreachable) +#include <__stddef_unreachable.h> +#undef __need_unreachable +#endif /* defined(__need_unreachable) */ + +#if defined(__need_max_align_t) +#include <__stddef_max_align_t.h> +#undef __need_max_align_t +#endif /* defined(__need_max_align_t) */ + +#if defined(__need_offsetof) +#include <__stddef_offsetof.h> +#undef __need_offsetof +#endif /* defined(__need_offsetof) */ /* Some C libraries expect to see a wint_t here. Others (notably MinGW) will use __WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */ #if defined(__need_wint_t) -/* Always define wint_t when modules are available. */ -#if !defined(_WINT_T) || __has_feature(modules) -#if !__has_feature(modules) -#define _WINT_T -#endif -typedef __WINT_TYPE__ wint_t; -#endif +#include <__stddef_wint_t.h> #undef __need_wint_t #endif /* __need_wint_t */ diff --git a/devel/wasi-libc/pkg-plist b/devel/wasi-libc/pkg-plist index 6b7902c5d833..1a52ec4c7996 100644 --- a/devel/wasi-libc/pkg-plist +++ b/devel/wasi-libc/pkg-plist @@ -21,6 +21,21 @@ share/wasi-sysroot/include/__macro_FD_SETSIZE.h share/wasi-sysroot/include/__macro_PAGESIZE.h share/wasi-sysroot/include/__mode_t.h share/wasi-sysroot/include/__seek.h +share/wasi-sysroot/include/__stdarg___gnuc_va_list.h +share/wasi-sysroot/include/__stdarg___va_copy.h +share/wasi-sysroot/include/__stdarg_va_arg.h +share/wasi-sysroot/include/__stdarg_va_copy.h +share/wasi-sysroot/include/__stdarg_va_list.h +share/wasi-sysroot/include/__stddef_max_align_t.h +share/wasi-sysroot/include/__stddef_null.h +share/wasi-sysroot/include/__stddef_nullptr_t.h +share/wasi-sysroot/include/__stddef_offsetof.h +share/wasi-sysroot/include/__stddef_ptrdiff_t.h +share/wasi-sysroot/include/__stddef_rsize_t.h +share/wasi-sysroot/include/__stddef_size_t.h +share/wasi-sysroot/include/__stddef_unreachable.h +share/wasi-sysroot/include/__stddef_wchar_t.h +share/wasi-sysroot/include/__stddef_wint_t.h share/wasi-sysroot/include/__struct_dirent.h share/wasi-sysroot/include/__struct_in6_addr.h share/wasi-sysroot/include/__struct_in_addr.h