FreeBSD Bugzilla – Attachment 178943 Details for
Bug 216033
[exp-run] Test use of clang nullability attributes in system headers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
nonnull replacement and attribute removal patch (take 2)
nullable-def.diff (text/plain), 27.79 KB, created by
Pedro F. Giffuni
on 2017-01-16 03:36:29 UTC
(
hide
)
Description:
nonnull replacement and attribute removal patch (take 2)
Filename:
MIME Type:
Creator:
Pedro F. Giffuni
Created:
2017-01-16 03:36:29 UTC
Size:
27.79 KB
patch
obsolete
>Index: include/err.h >=================================================================== >--- include/err.h (revision 312250) >+++ include/err.h (working copy) >@@ -43,6 +43,8 @@ > #include <sys/cdefs.h> > #include <sys/_types.h> > >+__BEGIN_NULLABILITY >+ > __BEGIN_DECLS > void err(int, const char *, ...) __dead2 __printf0like(2, 3); > void verr(int, const char *, __va_list) __dead2 __printf0like(2, 0); >@@ -58,7 +60,8 @@ > void warnx(const char *, ...) __printflike(1, 2); > void vwarnx(const char *, __va_list) __printflike(1, 0); > void err_set_file(void *); >-void err_set_exit(void (*)(int)); >+void err_set_exit(void (* _Nullable)(int)); > __END_DECLS >+__END_NULLABILITY > > #endif /* !_ERR_H_ */ >Index: include/pthread.h >=================================================================== >--- include/pthread.h (revision 312250) >+++ include/pthread.h (working copy) >@@ -46,6 +46,8 @@ > #include <sched.h> > #include <time.h> > >+__BEGIN_NULLABILITY >+ > /* > * Run-time invariant values: > */ >@@ -147,28 +149,35 @@ > */ > __BEGIN_DECLS > int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)); >-int pthread_attr_destroy(pthread_attr_t *); >-int pthread_attr_getstack(const pthread_attr_t * __restrict, >- void ** __restrict, size_t * __restrict); >-int pthread_attr_getstacksize(const pthread_attr_t *, size_t *); >-int pthread_attr_getguardsize(const pthread_attr_t *, size_t *); >+int pthread_attr_destroy(pthread_attr_t * _Nonnull); >+int pthread_attr_getstack( >+ const pthread_attr_t * _Nonnull __restrict, >+ void ** _Nonnull __restrict, >+ size_t * _Nonnull __restrict); >+int pthread_attr_getstacksize(const pthread_attr_t * _Nonnull, >+ size_t * _Nonnull); >+int pthread_attr_getguardsize(const pthread_attr_t * _Nonnull, >+ size_t * _Nonnull); > int pthread_attr_getstackaddr(const pthread_attr_t *, void **); >-int pthread_attr_getdetachstate(const pthread_attr_t *, int *); >-int pthread_attr_init(pthread_attr_t *); >-int pthread_attr_setstacksize(pthread_attr_t *, size_t); >-int pthread_attr_setguardsize(pthread_attr_t *, size_t); >-int pthread_attr_setstack(pthread_attr_t *, void *, size_t); >+int pthread_attr_getdetachstate(const pthread_attr_t * _Nonnull, >+ int * _Nonnull); >+int pthread_attr_init(pthread_attr_t * _Nonnull); >+int pthread_attr_setstacksize(pthread_attr_t * _Nonnull, size_t); >+int pthread_attr_setguardsize(pthread_attr_t * _Nonnull, size_t); >+int pthread_attr_setstack(pthread_attr_t * _Nonnull, void *, >+ size_t); > int pthread_attr_setstackaddr(pthread_attr_t *, void *); >-int pthread_attr_setdetachstate(pthread_attr_t *, int); >-int pthread_barrier_destroy(pthread_barrier_t *); >-int pthread_barrier_init(pthread_barrier_t *, >+int pthread_attr_setdetachstate(pthread_attr_t * _Nonnull, int); >+int pthread_barrier_destroy(pthread_barrier_t * _Nonnull); >+int pthread_barrier_init(pthread_barrier_t * _Nonnull, > const pthread_barrierattr_t *, unsigned); >-int pthread_barrier_wait(pthread_barrier_t *); >-int pthread_barrierattr_destroy(pthread_barrierattr_t *); >-int pthread_barrierattr_getpshared(const pthread_barrierattr_t *, >- int *); >-int pthread_barrierattr_init(pthread_barrierattr_t *); >-int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int); >+int pthread_barrier_wait(pthread_barrier_t * _Nonnull); >+int pthread_barrierattr_destroy(pthread_barrierattr_t * _Nonnull); >+int pthread_barrierattr_getpshared( >+ const pthread_barrierattr_t * _Nonnull, int * _Nonnull); >+int pthread_barrierattr_init(pthread_barrierattr_t * _Nonnull); >+int pthread_barrierattr_setpshared(pthread_barrierattr_t * _Nonnull, >+ int); > > #define pthread_cleanup_push(cleanup_routine, cleanup_arg) \ > { \ >@@ -183,100 +192,109 @@ > __pthread_cleanup_pop_imp(execute); \ > } > >-int pthread_condattr_destroy(pthread_condattr_t *); >-int pthread_condattr_getclock(const pthread_condattr_t *, >- clockid_t *); >-int pthread_condattr_getpshared(const pthread_condattr_t *, int *); >-int pthread_condattr_init(pthread_condattr_t *); >-int pthread_condattr_setclock(pthread_condattr_t *, clockid_t); >-int pthread_condattr_setpshared(pthread_condattr_t *, int); >-int pthread_cond_broadcast(pthread_cond_t *); >-int pthread_cond_destroy(pthread_cond_t *); >-int pthread_cond_init(pthread_cond_t *, >+int pthread_condattr_destroy(pthread_condattr_t * _Nonnull); >+int pthread_condattr_getclock(const pthread_condattr_t * _Nonnull, >+ clockid_t * _Nonnull); >+int pthread_condattr_getpshared(const pthread_condattr_t * _Nonnull, >+ int * _Nonnull); >+int pthread_condattr_init(pthread_condattr_t * _Nonnull); >+int pthread_condattr_setclock(pthread_condattr_t * _Nonnull, >+ clockid_t); >+int pthread_condattr_setpshared(pthread_condattr_t * _Nonnull, int); >+int pthread_cond_broadcast(pthread_cond_t * _Nonnull); >+int pthread_cond_destroy(pthread_cond_t * _Nonnull); >+int pthread_cond_init(pthread_cond_t * _Nonnull, > const pthread_condattr_t *); >-int pthread_cond_signal(pthread_cond_t *); >-int pthread_cond_timedwait(pthread_cond_t *, >- pthread_mutex_t *__mutex, const struct timespec *) >+int pthread_cond_signal(pthread_cond_t * _Nonnull); >+int pthread_cond_timedwait(pthread_cond_t * _Nonnull, >+ pthread_mutex_t * _Nonnull __mutex, >+ const struct timespec * _Nonnull) > __requires_exclusive(*__mutex); >-int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *__mutex) >+int pthread_cond_wait(pthread_cond_t * _Nonnull, >+ pthread_mutex_t * _Nonnull __mutex) > __requires_exclusive(*__mutex); >-int pthread_create(pthread_t *, const pthread_attr_t *, >- void *(*) (void *), void *); >+int pthread_create(pthread_t * _Nonnull, const pthread_attr_t *, >+ void *(* _Nonnull) (void *), void *); > int pthread_detach(pthread_t); > int pthread_equal(pthread_t, pthread_t); > void pthread_exit(void *) __dead2; > void *pthread_getspecific(pthread_key_t); >-int pthread_getcpuclockid(pthread_t, clockid_t *); >+int pthread_getcpuclockid(pthread_t, clockid_t * _Nonnull); > int pthread_join(pthread_t, void **); >-int pthread_key_create(pthread_key_t *, >- void (*) (void *)); >+int pthread_key_create(pthread_key_t * _Nonnull, >+ void (*) (void *)); > int pthread_key_delete(pthread_key_t); >-int pthread_mutexattr_init(pthread_mutexattr_t *); >-int pthread_mutexattr_destroy(pthread_mutexattr_t *); >-int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, >- int *); >-int pthread_mutexattr_gettype(pthread_mutexattr_t *, int *); >-int pthread_mutexattr_settype(pthread_mutexattr_t *, int); >-int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); >-int pthread_mutex_consistent(pthread_mutex_t *__mutex) >- __nonnull(1) __requires_exclusive(*__mutex); >-int pthread_mutex_destroy(pthread_mutex_t *__mutex) >+int pthread_mutexattr_init(pthread_mutexattr_t * _Nonnull); >+int pthread_mutexattr_destroy(pthread_mutexattr_t * _Nonnull); >+int pthread_mutexattr_getpshared( >+ const pthread_mutexattr_t * _Nonnull, int * _Nonnull); >+int pthread_mutexattr_gettype(pthread_mutexattr_t * _Nonnull, >+ int * _Nonnull); >+int pthread_mutexattr_settype(pthread_mutexattr_t * _Nonnull, int); >+int pthread_mutexattr_setpshared(pthread_mutexattr_t * _Nonnull, >+ int); >+int pthread_mutex_consistent(pthread_mutex_t * _Nonnull __mutex) >+ __requires_exclusive(*__mutex); >+int pthread_mutex_destroy(pthread_mutex_t * _Nonnull __mutex) > __requires_unlocked(*__mutex); >-int pthread_mutex_init(pthread_mutex_t *__mutex, >- const pthread_mutexattr_t *) >+int pthread_mutex_init(pthread_mutex_t * _Nonnull __mutex, >+ const pthread_mutexattr_t *) > __requires_unlocked(*__mutex); >-int pthread_mutex_lock(pthread_mutex_t *__mutex) >- __locks_exclusive(*__mutex); >-int pthread_mutex_trylock(pthread_mutex_t *__mutex) >- __trylocks_exclusive(0, *__mutex); >-int pthread_mutex_timedlock(pthread_mutex_t *__mutex, >- const struct timespec *) >- __trylocks_exclusive(0, *__mutex); >-int pthread_mutex_unlock(pthread_mutex_t *__mutex) >+int pthread_mutex_lock(pthread_mutex_t * _Nonnull __mutex) >+ __locks_exclusive(*__mutex); >+int pthread_mutex_trylock(pthread_mutex_t * _Nonnull __mutex) >+ __trylocks_exclusive(0, *__mutex); >+int pthread_mutex_timedlock(pthread_mutex_t * _Nonnull __mutex, >+ const struct timespec * _Nonnull) >+ __trylocks_exclusive(0, *__mutex); >+int pthread_mutex_unlock(pthread_mutex_t * _Nonnull __mutex) > __unlocks(*__mutex); >-int pthread_once(pthread_once_t *, void (*) (void)); >-int pthread_rwlock_destroy(pthread_rwlock_t *__rwlock) >+int pthread_once(pthread_once_t * _Nonnull, >+ void (* _Nonnull) (void)); >+int pthread_rwlock_destroy(pthread_rwlock_t * _Nonnull __rwlock) > __requires_unlocked(*__rwlock); >-int pthread_rwlock_init(pthread_rwlock_t *__rwlock, >- const pthread_rwlockattr_t *) >+int pthread_rwlock_init(pthread_rwlock_t * _Nonnull __rwlock, >+ const pthread_rwlockattr_t *) > __requires_unlocked(*__rwlock); >-int pthread_rwlock_rdlock(pthread_rwlock_t *__rwlock) >- __locks_shared(*__rwlock); >-int pthread_rwlock_timedrdlock(pthread_rwlock_t *__rwlock, >- const struct timespec *) >- __trylocks_shared(0, *__rwlock); >-int pthread_rwlock_timedwrlock(pthread_rwlock_t *__rwlock, >- const struct timespec *) >- __trylocks_exclusive(0, *__rwlock); >-int pthread_rwlock_tryrdlock(pthread_rwlock_t *__rwlock) >- __trylocks_shared(0, *__rwlock); >-int pthread_rwlock_trywrlock(pthread_rwlock_t *__rwlock) >- __trylocks_exclusive(0, *__rwlock); >-int pthread_rwlock_unlock(pthread_rwlock_t *__rwlock) >+int pthread_rwlock_rdlock(pthread_rwlock_t * _Nonnull __rwlock) >+ __locks_shared(*__rwlock); >+int pthread_rwlock_timedrdlock(pthread_rwlock_t * _Nonnull __rwlock, >+ const struct timespec * _Nonnull) >+ __trylocks_shared(0, *__rwlock); >+int pthread_rwlock_timedwrlock(pthread_rwlock_t * _Nonnull __rwlock, >+ const struct timespec * _Nonnull) >+ __trylocks_exclusive(0, *__rwlock); >+int pthread_rwlock_tryrdlock(pthread_rwlock_t * _Nonnull __rwlock) >+ __trylocks_shared(0, *__rwlock); >+int pthread_rwlock_trywrlock(pthread_rwlock_t * _Nonnull __rwlock) >+ __trylocks_exclusive(0, *__rwlock); >+int pthread_rwlock_unlock(pthread_rwlock_t * _Nonnull __rwlock) > __unlocks(*__rwlock); >-int pthread_rwlock_wrlock(pthread_rwlock_t *__rwlock) >- __locks_exclusive(*__rwlock); >-int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); >-int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *, >- int *); >-int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *, >- int *); >-int pthread_rwlockattr_init(pthread_rwlockattr_t *); >-int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *, int); >-int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int); >+int pthread_rwlock_wrlock(pthread_rwlock_t * _Nonnull __rwlock) >+ __locks_exclusive(*__rwlock); >+int pthread_rwlockattr_destroy(pthread_rwlockattr_t * _Nonnull); >+int pthread_rwlockattr_getkind_np( >+ const pthread_rwlockattr_t * _Nonnull, int *); >+int pthread_rwlockattr_getpshared( >+ const pthread_rwlockattr_t * _Nonnull, int * _Nonnull); >+int pthread_rwlockattr_init(pthread_rwlockattr_t * _Nonnull); >+int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t * _Nonnull, >+ int); >+int pthread_rwlockattr_setpshared(pthread_rwlockattr_t * _Nonnull, >+ int); > pthread_t pthread_self(void); > int pthread_setspecific(pthread_key_t, const void *); > >-int pthread_spin_init(pthread_spinlock_t *__spin, int) >+int pthread_spin_init(pthread_spinlock_t * _Nonnull __spin, int) > __requires_unlocked(*__spin); >-int pthread_spin_destroy(pthread_spinlock_t *__spin) >+int pthread_spin_destroy(pthread_spinlock_t * _Nonnull __spin) > __requires_unlocked(*__spin); >-int pthread_spin_lock(pthread_spinlock_t *__spin) >- __locks_exclusive(*__spin); >-int pthread_spin_trylock(pthread_spinlock_t *__spin) >- __trylocks_exclusive(0, *__spin); >-int pthread_spin_unlock(pthread_spinlock_t *__spin) >- __unlocks(*__spin); >+int pthread_spin_lock(pthread_spinlock_t * _Nonnull __spin) >+ __locks_exclusive(*__spin); >+int pthread_spin_trylock(pthread_spinlock_t * _Nonnull __spin) >+ __trylocks_exclusive(0, *__spin); >+int pthread_spin_unlock(pthread_spinlock_t * _Nonnull __spin) >+ __unlocks(*__spin); > int pthread_cancel(pthread_t); > int pthread_setcancelstate(int, int *); > int pthread_setcanceltype(int, int *); >@@ -288,10 +306,8 @@ > void pthread_yield(void); > #endif > >-int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *, >- int *); >-int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, >- int); >+int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *, int *); >+int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int); > int pthread_mutex_getprioceiling(pthread_mutex_t *, int *); > int pthread_mutex_setprioceiling(pthread_mutex_t *, int, int *); > >@@ -298,25 +314,28 @@ > int pthread_mutexattr_getprotocol(pthread_mutexattr_t *, int *); > int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int); > >-int pthread_mutexattr_getrobust(pthread_mutexattr_t *__restrict, >- int *__restrict) __nonnull_all; >-int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int) >- __nonnull(1); >+int pthread_mutexattr_getrobust( >+ pthread_mutexattr_t * _Nonnull __restrict, >+ int * _Nonnull __restrict); >+int pthread_mutexattr_setrobust(pthread_mutexattr_t * _Nonnull, >+ int); > > int pthread_attr_getinheritsched(const pthread_attr_t *, int *); >-int pthread_attr_getschedparam(const pthread_attr_t *, >- struct sched_param *); >-int pthread_attr_getschedpolicy(const pthread_attr_t *, int *); >-int pthread_attr_getscope(const pthread_attr_t *, int *); >+int pthread_attr_getschedparam(const pthread_attr_t * _Nonnull, >+ struct sched_param * _Nonnull); >+int pthread_attr_getschedpolicy(const pthread_attr_t * _Nonnull, >+ int * _Nonnull); >+int pthread_attr_getscope(const pthread_attr_t * _Nonnull, >+ int * _Nonnull); > int pthread_attr_setinheritsched(pthread_attr_t *, int); >-int pthread_attr_setschedparam(pthread_attr_t *, >- const struct sched_param *); >-int pthread_attr_setschedpolicy(pthread_attr_t *, int); >-int pthread_attr_setscope(pthread_attr_t *, int); >-int pthread_getschedparam(pthread_t pthread, int *, >- struct sched_param *); >+int pthread_attr_setschedparam(pthread_attr_t * _Nonnull, >+ const struct sched_param * _Nonnull); >+int pthread_attr_setschedpolicy(pthread_attr_t * _Nonnull, int); >+int pthread_attr_setscope(pthread_attr_t * _Nonnull, int); >+int pthread_getschedparam(pthread_t pthread, int * _Nonnull, >+ struct sched_param * _Nonnull); > int pthread_setschedparam(pthread_t, int, >- const struct sched_param *); >+ const struct sched_param * _Nonnull); > #if __XSI_VISIBLE > int pthread_getconcurrency(void); > int pthread_setconcurrency(int); >@@ -326,5 +345,6 @@ > struct _pthread_cleanup_info *); > void __pthread_cleanup_pop_imp(int); > __END_DECLS >+__END_NULLABILITY > >-#endif >+#endif /* _PTHREAD_H_ */ >Index: include/signal.h >=================================================================== >--- include/signal.h (revision 312250) >+++ include/signal.h (working copy) >@@ -41,6 +41,8 @@ > #include <sys/_ucontext.h> > #endif > >+__BEGIN_NULLABILITY >+ > #if __BSD_VISIBLE > /* > * XXX should enlarge these, if only to give empty names instead of bounds >@@ -82,10 +84,11 @@ > int sigemptyset(sigset_t *); > int sigfillset(sigset_t *); > int sigismember(const sigset_t *, int); >-int sigpending(sigset_t *); >+int sigpending(sigset_t * _Nonnull); > int sigprocmask(int, const sigset_t * __restrict, sigset_t * __restrict); >-int sigsuspend(const sigset_t *); >-int sigwait(const sigset_t * __restrict, int * __restrict); >+int sigsuspend(const sigset_t * _Nonnull); >+int sigwait(const sigset_t * _Nonnull __restrict, >+ int * _Nonnull __restrict); > #endif > > #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 600 >@@ -104,7 +107,7 @@ > int sigignore(int); > int sigpause(int); > int sigrelse(int); >-void (*sigset(int, void (*)(int)))(int); >+void (* _Nullable sigset(int, void (* _Nullable)(int)))(int); > int xsi_sigpause(int); > #endif > >@@ -124,5 +127,6 @@ > int sigvec(int, struct sigvec *, struct sigvec *); > #endif > __END_DECLS >+__END_NULLABILITY > > #endif /* !_SIGNAL_H_ */ >Index: include/stdio.h >=================================================================== >--- include/stdio.h (revision 312250) >+++ include/stdio.h (working copy) >@@ -40,6 +40,8 @@ > #include <sys/_null.h> > #include <sys/_types.h> > >+__BEGIN_NULLABILITY >+ > typedef __off_t fpos_t; > > #ifndef _SIZE_T_DECLARED >@@ -123,10 +125,10 @@ > > /* 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 */ >@@ -390,10 +392,10 @@ > * 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) > >@@ -506,4 +508,6 @@ > #endif /* __cplusplus */ > > __END_DECLS >+__END_NULLABILITY >+ > #endif /* !_STDIO_H_ */ >Index: include/stdlib.h >=================================================================== >--- include/stdlib.h (revision 312250) >+++ include/stdlib.h (working copy) >@@ -37,6 +37,8 @@ > #include <sys/_null.h> > #include <sys/_types.h> > >+__BEGIN_NULLABILITY >+ > #if __BSD_VISIBLE > #ifndef _RUNE_T_DECLARED > typedef __rune_t rune_t; >@@ -81,12 +83,12 @@ > > _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 @@ > 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); >@@ -256,9 +258,9 @@ > __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 */ >@@ -282,11 +284,13 @@ > 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 *)); >@@ -320,5 +324,6 @@ > extern char *suboptarg; /* getsubopt(3) external variable */ > #endif /* __BSD_VISIBLE */ > __END_DECLS >+__END_NULLABILITY > > #endif /* !_STDLIB_H_ */ >Index: lib/libthr/thread/thr_private.h >=================================================================== >--- lib/libthr/thread/thr_private.h (revision 312250) >+++ lib/libthr/thread/thr_private.h (working copy) >@@ -53,6 +53,8 @@ > #include <sys/thr.h> > #include <pthread.h> > >+__BEGIN_NULLABILITY >+ > #define SYM_FB10(sym) __CONCAT(sym, _fb10) > #define SYM_FBP10(sym) __CONCAT(sym, _fbp10) > #define WEAK_REF(sym, alias) __weak_reference(sym, alias) >@@ -835,11 +837,10 @@ > void _pthread_exit_mask(void *status, sigset_t *mask) __dead2 __hidden; > void _pthread_cancel_enter(int maycancel); > void _pthread_cancel_leave(int maycancel); >-int _pthread_mutex_consistent(pthread_mutex_t *) __nonnull(1); >-int _pthread_mutexattr_getrobust(pthread_mutexattr_t *__restrict, >- int *__restrict) __nonnull_all; >-int _pthread_mutexattr_setrobust(pthread_mutexattr_t *, int) >- __nonnull(1); >+int _pthread_mutex_consistent(pthread_mutex_t * _Nonnull); >+int _pthread_mutexattr_getrobust(pthread_mutexattr_t * _Nonnull __restrict, >+ int * _Nonnull __restrict); >+int _pthread_mutexattr_setrobust(pthread_mutexattr_t * _Nonnull, int); > > /* #include <fcntl.h> */ > #ifdef _SYS_FCNTL_H_ >@@ -984,5 +985,6 @@ > void __thr_pshared_atfork_post(void) __hidden; > > __END_DECLS >+__END_NULLABILITY > > #endif /* !_THR_PRIVATE_H */ >Index: sys/sys/cdefs.h >=================================================================== >--- sys/sys/cdefs.h (revision 312250) >+++ sys/sys/cdefs.h (working copy) >@@ -375,14 +375,6 @@ > #define __noinline > #endif > >-#if __GNUC_PREREQ__(3, 3) >-#define __nonnull(x) __attribute__((__nonnull__(x))) >-#define __nonnull_all __attribute__((__nonnull__)) >-#else >-#define __nonnull(x) >-#define __nonnull_all >-#endif >- > #if __GNUC_PREREQ__(3, 4) > #define __fastcall __attribute__((__fastcall__)) > #define __result_use_check __attribute__((__warn_unused_result__)) >@@ -793,6 +785,12 @@ > #if !(defined(__clang__) && __has_feature(nullability)) > #define _Nonnull > #define _Nullable >+#define __BEGIN_NULLABILITY >+#define __END_NULLABILITY >+#else >+#define __BEGIN_NULLABILITY _Pragma("clang diagnostic push") \ >+ _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"") >+#define __END_NULLABILITY _Pragma("clang diagnostic pop") > #endif > > /* >Index: sys/sys/systm.h >=================================================================== >--- sys/sys/systm.h (revision 312250) >+++ sys/sys/systm.h (working copy) >@@ -45,6 +45,8 @@ > #include <sys/queue.h> > #include <sys/stdint.h> /* for people using printf mainly */ > >+__BEGIN_NULLABILITY >+ > extern int cold; /* nonzero if we are doing a cold boot */ > extern int suspend_blocked; /* block suspend due to pending shutdown */ > extern int rebooting; /* kern_reboot() has been called. */ >@@ -227,12 +229,12 @@ > int vsnrprintf(char *, size_t, int, const char *, __va_list) __printflike(4, 0); > int vsprintf(char *buf, const char *, __va_list) __printflike(2, 0); > int ttyprintf(struct tty *, const char *, ...) __printflike(2, 3); >-int sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2) __scanflike(2, 3); >-int vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2) __scanflike(2, 0); >-long strtol(const char *, char **, int) __nonnull(1); >-u_long strtoul(const char *, char **, int) __nonnull(1); >-quad_t strtoq(const char *, char **, int) __nonnull(1); >-u_quad_t strtouq(const char *, char **, int) __nonnull(1); >+int sscanf(const char *, char const * _Nonnull, ...) __scanflike(2, 3); >+int vsscanf(const char * _Nonnull, char const * _Nonnull, __va_list) __scanflike(2, 0); >+long strtol(const char *, char **, int); >+u_long strtoul(const char *, char **, int); >+quad_t strtoq(const char *, char **, int); >+u_quad_t strtouq(const char *, char **, int); > void tprintf(struct proc *p, int pri, const char *, ...) __printflike(3, 4); > void vtprintf(struct proc *, int, const char *, __va_list) __printflike(3, 0); > void hexdump(const void *ptr, int length, const char *hdr, int flags); >@@ -243,27 +245,27 @@ > #define HD_OMIT_CHARS (1 << 18) > > #define ovbcopy(f, t, l) bcopy((f), (t), (l)) >-void bcopy(const void *from, void *to, size_t len) __nonnull(1) __nonnull(2); >-void bzero(void *buf, size_t len) __nonnull(1); >-void explicit_bzero(void *, size_t) __nonnull(1); >+void bcopy(const void * _Nonnull from, void * _Nonnull to, size_t len); >+void bzero(void * _Nonnull buf, size_t len); >+void explicit_bzero(void * _Nonnull, size_t); > >-void *memcpy(void *to, const void *from, size_t len) __nonnull(1) __nonnull(2); >-void *memmove(void *dest, const void *src, size_t n) __nonnull(1) __nonnull(2); >+void *memcpy(void * _Nonnull to, const void * _Nonnull from, size_t len); >+void *memmove(void * _Nonnull dest, const void * _Nonnull src, size_t n); > >-int copystr(const void * __restrict kfaddr, void * __restrict kdaddr, >- size_t len, size_t * __restrict lencopied) >- __nonnull(1) __nonnull(2); >-int copyinstr(const void * __restrict udaddr, void * __restrict kaddr, >- size_t len, size_t * __restrict lencopied) >- __nonnull(1) __nonnull(2); >-int copyin(const void * __restrict udaddr, void * __restrict kaddr, >- size_t len) __nonnull(1) __nonnull(2); >-int copyin_nofault(const void * __restrict udaddr, void * __restrict kaddr, >- size_t len) __nonnull(1) __nonnull(2); >-int copyout(const void * __restrict kaddr, void * __restrict udaddr, >- size_t len) __nonnull(1) __nonnull(2); >-int copyout_nofault(const void * __restrict kaddr, void * __restrict udaddr, >- size_t len) __nonnull(1) __nonnull(2); >+int copystr(const void * _Nonnull __restrict kfaddr, >+ void * _Nonnull __restrict kdaddr, size_t len, >+ size_t * __restrict lencopied); >+int copyinstr(const void * __restrict udaddr, >+ void * _Nonnull __restrict kaddr, size_t len, >+ size_t * __restrict lencopied); >+int copyin(const void * _Nonnull __restrict udaddr, >+ void * _Nonnull __restrict kaddr, size_t len); >+int copyin_nofault(const void * _Nonnull __restrict udaddr, >+ void * _Nonnull __restrict kaddr, size_t len); >+int copyout(const void * _Nonnull __restrict kaddr, >+ void * _Nonnull __restrict udaddr, size_t len); >+int copyout_nofault(const void * _Nonnull __restrict kaddr, >+ void * _Nonnull __restrict udaddr, size_t len); > > int fubyte(volatile const void *base); > long fuword(volatile const void *base); >@@ -374,8 +376,8 @@ > * Common `proc' functions are declared here so that proc.h can be included > * less often. > */ >-int _sleep(void *chan, struct lock_object *lock, int pri, const char *wmesg, >- sbintime_t sbt, sbintime_t pr, int flags) __nonnull(1); >+int _sleep(void * _Nonnull chan, struct lock_object *lock, int pri, >+ const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags); > #define msleep(chan, mtx, pri, wmesg, timo) \ > _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), \ > tick_sbt * (timo), 0, C_HARDCLOCK) >@@ -382,8 +384,8 @@ > #define msleep_sbt(chan, mtx, pri, wmesg, bt, pr, flags) \ > _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (bt), (pr), \ > (flags)) >-int msleep_spin_sbt(void *chan, struct mtx *mtx, const char *wmesg, >- sbintime_t sbt, sbintime_t pr, int flags) __nonnull(1); >+int msleep_spin_sbt(void * _Nonnull chan, struct mtx *mtx, >+ const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags); > #define msleep_spin(chan, mtx, wmesg, timo) \ > msleep_spin_sbt((chan), (mtx), (wmesg), tick_sbt * (timo), \ > 0, C_HARDCLOCK) >@@ -396,8 +398,8 @@ > 0, C_HARDCLOCK) > #define tsleep_sbt(chan, pri, wmesg, bt, pr, flags) \ > _sleep((chan), NULL, (pri), (wmesg), (bt), (pr), (flags)) >-void wakeup(void *chan) __nonnull(1); >-void wakeup_one(void *chan) __nonnull(1); >+void wakeup(void * chan); >+void wakeup_one(void * chan); > > /* > * Common `struct cdev *' stuff are declared here to avoid #include poisoning >@@ -445,4 +447,6 @@ > > void counted_warning(unsigned *counter, const char *msg); > >+__END_NULLABILITY >+ > #endif /* !_SYS_SYSTM_H_ */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 216033
:
178861
|
178870
|
178942
|
178943
|
179141