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

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

commit fd586fab90d78f3c777f3f141267be2e63b3351c
Author: Marco Casaroli <[email protected]>
AuthorDate: Wed Oct 28 00:34:11 2026 +0100

    include/sys/types.h: Hide unchar and s_char with NUTTX_NO_EXTENSIONS.
    
    Other C libraries do not define the types unchar and s_char.  Programs
    from other systems use these names for their own things, for example
    the s_char() function of gdbm's tools, and did not compile.  With
    NUTTX_NO_EXTENSIONS, sys/types.h does not define them.  The other BSD
    and System V types (u_char, ushort, uint, ulong, caddr_t, ...) stay,
    because other C libraries have them too.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 include/nuttx/compiler.h | 9 +++++----
 include/sys/types.h      | 9 +++++++--
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h
index dfc63bd4fd9..ecb133b4e61 100644
--- a/include/nuttx/compiler.h
+++ b/include/nuttx/compiler.h
@@ -1623,10 +1623,11 @@
  * and lutimens() (sys/stat.h), the file system types *_MAGIC
  * (sys/statfs.h), PANIC(), PANIC_WITH_REGS(), ASSERT(), VERIFY(),
  * COMPILE_TIME_ASSERT() and BUILD_BUG_ON_ZERO() (assert.h), crypt_r()
- * (unistd.h) and the helper macros of this file below, such as
- * memory_barrier() and UNUSED().  The headers that a program includes do
- * not use these names.  A definition that the program made before is
- * restored (saved at the start of this file).
+ * (unistd.h), the types unchar and s_char (sys/types.h) and the helper
+ * macros of this file below, such as memory_barrier() and UNUSED().  The
+ * headers that a program includes do not use these names.  A definition
+ * that the program made before is restored (saved at the start of this
+ * file).
  */
 
 #ifdef NUTTX_NO_EXTENSIONS
diff --git a/include/sys/types.h b/include/sys/types.h
index 239bebfe7fc..afc4003ec0e 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -275,13 +275,18 @@ typedef unsigned short u_short;
 typedef unsigned int   u_int;
 typedef unsigned long  u_long;
 
-/* SYSV types provided only to support porting to NuttX.  */
+/* SYSV types provided only to support porting to NuttX.  unchar and
+ * s_char are not in other C libraries: not with NUTTX_NO_EXTENSIONS (see
+ * nuttx/compiler.h), so that a program can use the names.
+ */
 
+#ifndef NUTTX_NO_EXTENSIONS
 typedef unsigned char  unchar;
+typedef signed char    s_char;
+#endif
 typedef unsigned short ushort;
 typedef unsigned int   uint;
 typedef unsigned long  ulong;
-typedef signed char    s_char;
 typedef FAR char      *caddr_t;
 
 /* These were defined by ISO C without the first `_'.  */

Reply via email to