summaryrefslogtreecommitdiffstats
path: root/include/stdio.h
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2017-03-14 20:14:57 +0000
committerpfg <pfg@FreeBSD.org>2017-03-14 20:14:57 +0000
commit8c08bfe0a237cbc568a58adcefa2b61e7a46fa9d (patch)
tree885ac3dd460b34cb7e8b9a30b568a3592fb4725e /include/stdio.h
parent85fddbd8bf2c10c05892daf14ffca4458f839f38 (diff)
downloadFreeBSD-src-8c08bfe0a237cbc568a58adcefa2b61e7a46fa9d.zip
FreeBSD-src-8c08bfe0a237cbc568a58adcefa2b61e7a46fa9d.tar.gz
MFC r312934:
Make use of clang nullability attributes in C headers. Replace uses of the GCC __nonnull__ attribute with the clang nullability qualifiers. These are starting to get use in clang's static analyzer. Replacement should be transparent for developers using clang. GCC ports from older FreeBSD versions may need updating if the compiler was built before r312860 (Jan-27-2017). Hinted by: Apple's Libc-1158.20.4, Bionic libc Relnotes: yes
Diffstat (limited to 'include/stdio.h')
-rw-r--r--include/stdio.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/include/stdio.h b/include/stdio.h
index 7b7980e..4c82f90 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -40,6 +40,8 @@
#include <sys/_null.h>
#include <sys/_types.h>
+__NULLABILITY_PRAGMA_PUSH
+
typedef __off_t fpos_t;
#ifndef _SIZE_T_DECLARED
@@ -123,10 +125,10 @@ struct __sFILE {
/* operations */
void *_cookie; /* (*) cookie passed to io functions */
- int (*_close)(void *);
- int (*_read)(void *, char *, int);
- fpos_t (*_seek)(void *, fpos_t, int);
- int (*_write)(void *, const char *, int);
+ int (* _Nullable _close)(void *);
+ int (* _Nullable _read)(void *, char *, int);
+ fpos_t (* _Nullable _seek)(void *, fpos_t, int);
+ int (* _Nullable _write)(void *, const char *, int);
/* separate buffer for long sequences of ungetc() */
struct __sbuf _ub; /* ungetc buffer */
@@ -425,10 +427,10 @@ extern const char * const sys_errlist[];
* Stdio function-access interface.
*/
FILE *funopen(const void *,
- int (*)(void *, char *, int),
- int (*)(void *, const char *, int),
- fpos_t (*)(void *, fpos_t, int),
- int (*)(void *));
+ int (* _Nullable)(void *, char *, int),
+ int (* _Nullable)(void *, const char *, int),
+ fpos_t (* _Nullable)(void *, fpos_t, int),
+ int (* _Nullable)(void *));
#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
@@ -541,4 +543,6 @@ extern int __isthreaded;
#endif /* __cplusplus */
__END_DECLS
+__NULLABILITY_PRAGMA_POP
+
#endif /* !_STDIO_H_ */
OpenPOWER on IntegriCloud