Date: Tue, 24 Feb 2026 20:45:42 +0000 From: Ahmad Khalifa <vexeduxr@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 0c075db78a98 - main - tools/build/stddef.h: fix stock clang/gcc headers Message-ID: <699e0df6.23cd1.cb2856a@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=0c075db78a98de8e3a255597d045bcd24ba27be7 commit 0c075db78a98de8e3a255597d045bcd24ba27be7 Author: Ahmad Khalifa <vexeduxr@FreeBSD.org> AuthorDate: 2026-02-24 20:11:12 +0000 Commit: Ahmad Khalifa <vexeduxr@FreeBSD.org> CommitDate: 2026-02-24 20:42:21 +0000 tools/build/stddef.h: fix stock clang/gcc headers Both clang and gcc's stddef.h are designed to be included multiple times with different combinations of __need_* macros defined (e.g __need_size_t). Remove the #pragma once to accommodate this, ptraddr_t is guarded by _PTRADDR_T_DECLARED anyways. Also use __SIZE_TYPE__ instead of size_t since it's not guaranteed to be defined. Reviewed by: brooks, imp, kib Differential Revision: https://reviews.freebsd.org/D55453 --- tools/build/stddef.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/build/stddef.h b/tools/build/stddef.h index 77348dd57149..ca6d481a9d29 100644 --- a/tools/build/stddef.h +++ b/tools/build/stddef.h @@ -36,14 +36,24 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#pragma once + +/* + * The header guard is left out on purpose here. Both clang and gcc's + * stddef.h are designed to be included multiple times with different + * combinations of __need_* macros defined (e.g __need_size_t). + */ + #include_next <stddef.h> #ifndef _PTRADDR_T_DECLARED #ifdef __PTRADDR_TYPE__ typedef __PTRADDR_TYPE__ ptraddr_t; #else -typedef size_t ptraddr_t; +/* + * If anything other than __need_size_t is defined (see above), we won't + * have size_t. Use __SIZE_TYPE__ instead. + */ +typedef __SIZE_TYPE__ ptraddr_t; #endif #define _PTRADDR_T_DECLARED #endifhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?699e0df6.23cd1.cb2856a>
