[PATCH] stdio-common: Add nonnull attribute to stdio_ext.h functions.

Collin Funk collin.funk1@gmail.com
Mon May 19 04:32:42 GMT 2025


* stdio-common/stdio_ext.h (__fbufsize, __freading, __fwriting)
(__freadable, __fwritable, __flbf, __fpurge, __fpending, __fsetlocking):
Add __nonnull ((1)) to these functions since they access the FP without
checking if it is NULL.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
---
 stdio-common/stdio_ext.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/stdio-common/stdio_ext.h b/stdio-common/stdio_ext.h
index 3a9a98156e..397b37f575 100644
--- a/stdio-common/stdio_ext.h
+++ b/stdio-common/stdio_ext.h
@@ -43,43 +43,43 @@ __BEGIN_DECLS
 
 /* Return the size of the buffer of FP in bytes currently in use by
    the given stream.  */
-extern size_t __fbufsize (FILE *__fp) __THROW;
+extern size_t __fbufsize (FILE *__fp) __THROW __nonnull ((1));
 
 
 /* Return non-zero value iff the stream FP is opened readonly, or if the
    last operation on the stream was a read operation.  */
-extern int __freading (FILE *__fp) __THROW;
+extern int __freading (FILE *__fp) __THROW __nonnull ((1));
 
 /* Return non-zero value iff the stream FP is opened write-only or
    append-only, or if the last operation on the stream was a write
    operation.  */
-extern int __fwriting (FILE *__fp) __THROW;
+extern int __fwriting (FILE *__fp) __THROW __nonnull ((1));
 
 
 /* Return non-zero value iff stream FP is not opened write-only or
    append-only.  */
-extern int __freadable (FILE *__fp) __THROW;
+extern int __freadable (FILE *__fp) __THROW __nonnull ((1));
 
 /* Return non-zero value iff stream FP is not opened read-only.  */
-extern int __fwritable (FILE *__fp) __THROW;
+extern int __fwritable (FILE *__fp) __THROW __nonnull ((1));
 
 
 /* Return non-zero value iff the stream FP is line-buffered.  */
-extern int __flbf (FILE *__fp) __THROW;
+extern int __flbf (FILE *__fp) __THROW __nonnull ((1));
 
 
 /* Discard all pending buffered I/O on the stream FP.  */
-extern void __fpurge (FILE *__fp) __THROW;
+extern void __fpurge (FILE *__fp) __THROW __nonnull ((1));
 
 /* Return amount of output in bytes pending on a stream FP.  */
-extern size_t __fpending (FILE *__fp) __THROW;
+extern size_t __fpending (FILE *__fp) __THROW __nonnull ((1));
 
 /* Flush all line-buffered files.  */
 extern void _flushlbf (void);
 
 
 /* Set locking status of stream FP to TYPE.  */
-extern int __fsetlocking (FILE *__fp, int __type) __THROW;
+extern int __fsetlocking (FILE *__fp, int __type) __THROW __nonnull ((1));
 
 __END_DECLS
 
-- 
2.49.0



More information about the Libc-alpha mailing list