summaryrefslogtreecommitdiffstats
path: root/include/stdlib.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/stdlib.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/stdlib.h')
-rw-r--r--include/stdlib.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/include/stdlib.h b/include/stdlib.h
index 1de702f..26a2775 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -37,6 +37,8 @@
#include <sys/_null.h>
#include <sys/_types.h>
+__NULLABILITY_PRAGMA_PUSH
+
#if __BSD_VISIBLE
#ifndef _RUNE_T_DECLARED
typedef __rune_t rune_t;
@@ -81,12 +83,12 @@ extern int ___mb_cur_max(void);
_Noreturn void abort(void);
int abs(int) __pure2;
-int atexit(void (*)(void));
+int atexit(void (* _Nonnull)(void));
double atof(const char *);
int atoi(const char *);
long atol(const char *);
void *bsearch(const void *, const void *, size_t,
- size_t, int (*)(const void *, const void *));
+ size_t, int (*)(const void * _Nonnull, const void *));
void *calloc(size_t, size_t) __malloc_like __result_use_check
__alloc_size(1) __alloc_size(2);
div_t div(int, int) __pure2;
@@ -100,7 +102,7 @@ int mblen(const char *, size_t);
size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
int mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
void qsort(void *, size_t, size_t,
- int (*)(const void *, const void *));
+ int (* _Nonnull)(const void *, const void *));
int rand(void);
void *realloc(void *, size_t) __result_use_check __alloc_size(2);
void srand(unsigned);
@@ -260,9 +262,9 @@ void arc4random_stir(void);
__uint32_t
arc4random_uniform(__uint32_t);
#ifdef __BLOCKS__
-int atexit_b(void (^)(void));
+int atexit_b(void (^ _Nonnull)(void));
void *bsearch_b(const void *, const void *, size_t,
- size_t, int (^)(const void *, const void *));
+ size_t, int (^ _Nonnull)(const void *, const void *));
#endif
char *getbsize(int *, long *);
/* getcap(3) functions */
@@ -286,11 +288,13 @@ int getloadavg(double [], int);
const char *
getprogname(void);
-int heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
+int heapsort(void *, size_t, size_t,
+ int (* _Nonnull)(const void *, const void *));
#ifdef __BLOCKS__
-int heapsort_b(void *, size_t, size_t, int (^)(const void *, const void *));
+int heapsort_b(void *, size_t, size_t,
+ int (^ _Nonnull)(const void *, const void *));
void qsort_b(void *, size_t, size_t,
- int (^)(const void *, const void *));
+ int (^ _Nonnull)(const void *, const void *));
#endif
int l64a_r(long, char *, int);
int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
@@ -324,5 +328,6 @@ __uint64_t
extern char *suboptarg; /* getsubopt(3) external variable */
#endif /* __BSD_VISIBLE */
__END_DECLS
+__NULLABILITY_PRAGMA_POP
#endif /* !_STDLIB_H_ */
OpenPOWER on IntegriCloud