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 d346c7214ed7db6f262a61e7da75f561558700e3
Author: Marco Casaroli <[email protected]>
AuthorDate: Fri Oct 23 05:48:08 2026 +0200

    include/fcntl.h: Hide O_BINARY with NUTTX_NO_EXTENSIONS.
    
    With NUTTX_NO_EXTENSIONS, <fcntl.h> did not define O_TEXT, but it still
    defined O_BINARY.  A program that tests O_BINARY and then uses O_TEXT
    failed to compile: O_TEXT undeclared.
    
    O_BINARY and O_TEXT are a pair of non-standard flags, so hide both.
    Update the list in nuttx/compiler.h.  The other names that
    NUTTX_NO_EXTENSIONS hides (ERROR and OK, set_errno() and get_errno(),
    zalloc()) have no such partner that stays.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 include/fcntl.h          | 2 ++
 include/nuttx/compiler.h | 9 +++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/include/fcntl.h b/include/fcntl.h
index 539711f9c02..8840ed1e4d6 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -89,7 +89,9 @@
 #define O_NDELAY     O_NONBLOCK                  /* Synonym for O_NONBLOCK */
 #define O_SYNC       (__O_SYNC | O_DSYNC)        /* Synchronize output on 
write */
 #define O_RSYNC      O_SYNC                      /* Synchronize input on read 
*/
+#ifndef NUTTX_NO_EXTENSIONS                      /* See nuttx/compiler.h */
 #define O_BINARY     0                           /* Open the file in binary 
mode */
+#endif
 
 /* This is the highest bit number used in the open flags bitset.  Bits above
  * this bit number may be used within NuttX for other, internal purposes.
diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h
index fc461022014..25a86232830 100644
--- a/include/nuttx/compiler.h
+++ b/include/nuttx/compiler.h
@@ -1619,10 +1619,11 @@
 /* A program can define NUTTX_NO_EXTENSIONS before the first #include to
  * keep some non-standard names free for its own use.  Then the headers do
  * not define ERROR and OK (sys/types.h), set_errno() and get_errno()
- * (errno.h), zalloc() (stdlib.h), O_TEXT (fcntl.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).
+ * (errno.h), zalloc() (stdlib.h), O_TEXT and O_BINARY (fcntl.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

Reply via email to