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 de9f71be1c29839fa84580f4b2f07cfba0507370
Author: Marco Casaroli <[email protected]>
AuthorDate: Tue Oct 20 15:47:05 2026 +0200

    include/stdio.h: Define __FILE_defined and __DEFINED_FILE.
    
    Some headers declare their functions with FILE parameters only when
    they see that <stdio.h> was included: gmp.h, for example, tests a list
    of the include guards and FILE markers of many C libraries.  The NuttX
    guard __INCLUDE_STDIO_H is not in such lists, so a program that includes
    <stdio.h> and then <gmp.h> gets no mpz_out_str() or gmp_fprintf().
    
    Define the markers that glibc (__FILE_defined) and musl (__DEFINED_FILE)
    define next to their FILE type.  They say only that FILE is declared;
    the include guard does not change.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 include/stdio.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/stdio.h b/include/stdio.h
index 5df99b732f3..dd807a5036f 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -218,8 +218,13 @@ struct file_struct
 };
 #endif /* CONFIG_FILE_STREAM */
 
-/* Streams */
+/* Streams.  __FILE_defined and __DEFINED_FILE say that FILE is declared,
+ * as in glibc and musl: headers such as gmp.h test them before they
+ * declare their functions with FILE parameters.
+ */
 
+#define __FILE_defined 1
+#define __DEFINED_FILE 1
 typedef struct file_struct FILE;
 
 /****************************************************************************

Reply via email to