The branch main has been updated by vexeduxr:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0c075db78a98de8e3a255597d045bcd24ba27be7

commit 0c075db78a98de8e3a255597d045bcd24ba27be7
Author:     Ahmad Khalifa <[email protected]>
AuthorDate: 2026-02-24 20:11:12 +0000
Commit:     Ahmad Khalifa <[email protected]>
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
 #endif

Reply via email to