This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit b348a53d4f0ffac7811e57f85a65a9b057c2147a
Author: Marco Casaroli <[email protected]>
AuthorDate: Tue Oct 20 15:45:57 2026 +0200

    include: Make sys/random.h, obstack.h, shadow.h and vm_sockets.h 
self-contained.
    
    These public headers use types or macros that they do not include:
    
    - sys/random.h: ssize_t and FAR, from <stddef.h> only;
    - obstack.h: FAR;
    - shadow.h: size_t;
    - netpacket/vm_sockets.h: struct sockaddr.
    
    They compiled only when NuttX's own <stddef.h> came first or when the
    program included the missing header before.  A compiler driver that
    searches its own headers first (GCC's stddef.h) fails on
    "#include <sys/random.h>" alone.  Include what each header uses.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 include/netpacket/vm_sockets.h | 1 +
 include/obstack.h              | 2 ++
 include/shadow.h               | 2 ++
 include/sys/random.h           | 2 +-
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/netpacket/vm_sockets.h b/include/netpacket/vm_sockets.h
index 14f7c76878c..69627cf3c4a 100644
--- a/include/netpacket/vm_sockets.h
+++ b/include/netpacket/vm_sockets.h
@@ -26,6 +26,7 @@
  ****************************************************************************/
 
 #include <sys/types.h>
+#include <sys/socket.h>
 
 #include <nuttx/fs/ioctl.h>
 
diff --git a/include/obstack.h b/include/obstack.h
index efd27816ec8..696cf3afd29 100644
--- a/include/obstack.h
+++ b/include/obstack.h
@@ -44,6 +44,8 @@
  * Included Files
  ****************************************************************************/
 
+#include <nuttx/compiler.h>
+
 #include <stddef.h>
 #include <stdarg.h>
 
diff --git a/include/shadow.h b/include/shadow.h
index 8e271c9c51e..d85f9b132eb 100644
--- a/include/shadow.h
+++ b/include/shadow.h
@@ -27,6 +27,8 @@
 
 #include <nuttx/compiler.h>
 
+#include <sys/types.h>
+
 /****************************************************************************
  * Public Type Declarations
  ****************************************************************************/
diff --git a/include/sys/random.h b/include/sys/random.h
index 98c75bb80e7..6e740f3d1cd 100644
--- a/include/sys/random.h
+++ b/include/sys/random.h
@@ -27,7 +27,7 @@
  * Included Files
  ****************************************************************************/
 
-#include <stddef.h>
+#include <sys/types.h>
 
 /****************************************************************************
  * Pre-processor Definitions

Reply via email to