From b2970d5e5be3142f4f50d589b886b53567818bcc Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sun, 18 May 2025 21:32:42 -0700 Subject: [PATCH] stdio-common: Add nonnull attribute to stdio_ext.h functions. * 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 Reviewed-by: Adhemerval Zanella --- 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