From owner-svn-src-all@freebsd.org  Mon Jan  2 07:45:01 2017
Return-Path: <owner-svn-src-all@freebsd.org>
Delivered-To: svn-src-all@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02C46C9B907;
 Mon,  2 Jan 2017 07:45:01 +0000 (UTC)
 (envelope-from cse.cem@gmail.com)
Received: from mail-wj0-f171.google.com (mail-wj0-f171.google.com
 [209.85.210.171])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 79BD41E75;
 Mon,  2 Jan 2017 07:45:00 +0000 (UTC)
 (envelope-from cse.cem@gmail.com)
Received: by mail-wj0-f171.google.com with SMTP id sd9so234669724wjb.1;
 Sun, 01 Jan 2017 23:45:00 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:reply-to:in-reply-to:references
 :from:date:message-id:subject:to:cc;
 bh=UD5Fu1QRMqyDmcjkB5UN5lVqAJ7IkZi80/vQXzkcp1o=;
 b=qGe54QoFVTe+26lhEjeSAWscJvQDC3PdCyqVZ9SmHRM4E4aModBNQUBmrVa7EmZDTW
 41XqF67Ll1Q3hKto0eRQGun//VmcbKe4mPIz9aoLtNBM503S3m+3U+8Z5Sum7nK7egCw
 CT2AcYnDX+URWfhPyQSDz25cnQi9t/bLVJF5pvkt/RgBcsx3gTLOvam7VyyI044KYM4z
 6kkxyez9c7XPeJbfDJ4qB3KSilJHkRZG9Fer4wGnhmSPUIEXXkYFSIvA4CzSPU/NxaS+
 kd9KWknPmr2gng0nsFyI7/aeZclIlOBerF906rotfOlSthuwgQdxI7kJRgJfz4/AfaE/
 40Iw==
X-Gm-Message-State: AIkVDXKIOFJt0Zg20UsUjJ7Q7yjSuphdwcaiz1EOoJS6hYLbovGSfBggKCDWzfwBg3XkTA==
X-Received: by 10.195.14.66 with SMTP id fe2mr308529wjd.25.1483294653649;
 Sun, 01 Jan 2017 10:17:33 -0800 (PST)
Received: from mail-wj0-f173.google.com (mail-wj0-f173.google.com.
 [209.85.210.173])
 by smtp.gmail.com with ESMTPSA id bf2sm83590867wjc.48.2017.01.01.10.17.33
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 01 Jan 2017 10:17:33 -0800 (PST)
Received: by mail-wj0-f173.google.com with SMTP id v7so412306894wjy.2;
 Sun, 01 Jan 2017 10:17:33 -0800 (PST)
X-Received: by 10.194.94.132 with SMTP id dc4mr45910935wjb.231.1483294653278; 
 Sun, 01 Jan 2017 10:17:33 -0800 (PST)
MIME-Version: 1.0
Reply-To: cem@freebsd.org
Received: by 10.194.29.72 with HTTP; Sun, 1 Jan 2017 10:17:32 -0800 (PST)
In-Reply-To: <201701011716.v01HGmM2095585@repo.freebsd.org>
References: <201701011716.v01HGmM2095585@repo.freebsd.org>
From: Conrad Meyer <cem@freebsd.org>
Date: Sun, 1 Jan 2017 10:17:32 -0800
X-Gmail-Original-Message-ID: <CAG6CVpVqxYXoSYhZY+GgjaUdJV7o2C5djYnOkohv+NQFfiSEDA@mail.gmail.com>
Message-ID: <CAG6CVpVqxYXoSYhZY+GgjaUdJV7o2C5djYnOkohv+NQFfiSEDA@mail.gmail.com>
Subject: Re: svn commit: r311012 - head/include
To: "Pedro F. Giffuni" <pfg@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, 
 svn-src-head@freebsd.org
Content-Type: text/plain; charset=UTF-8
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Jan 2017 07:45:01 -0000

Hey Pedro,

Why not just remove __nonnull and replace it with _Nonnull in the same commit?

Best,
Conrad

On Sun, Jan 1, 2017 at 9:16 AM, Pedro F. Giffuni <pfg@freebsd.org> wrote:
> Author: pfg
> Date: Sun Jan  1 17:16:47 2017
> New Revision: 311012
> URL: https://svnweb.freebsd.org/changeset/base/311012
>
> Log:
>   Remove some uses of the GCC __nonnull() attribute.
>
>   While the checks are considered useful, the attribute does dangerous
>   optimizations, removing NULL checks where they can be needed. Remove the
>   uses of this attribute introduced in r281130: the changes were inspired on
>   Google's bionic where this attribute is not used anymore.
>
>   The __nonnull() attribute will be deprecrated from our headers and
>   replaced with the Clang _Nonnull qualifier in the future.
>
>   MFC after:    3 days
>
> Modified:
>   head/include/pthread.h
>   head/include/signal.h
>   head/include/stdlib.h
>
> Modified: head/include/pthread.h
> ==============================================================================
> --- head/include/pthread.h      Sun Jan  1 12:35:41 2017        (r311011)
> +++ head/include/pthread.h      Sun Jan  1 17:16:47 2017        (r311012)
> @@ -147,25 +147,19 @@ struct _pthread_cleanup_info {
>   */
>  __BEGIN_DECLS
>  int            pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
> -int            pthread_attr_destroy(pthread_attr_t *) __nonnull(1);
> +int            pthread_attr_destroy(pthread_attr_t *);
>  int            pthread_attr_getstack(const pthread_attr_t * __restrict,
> -                       void ** __restrict, size_t * __restrict)
> -                       __nonnull_all;
> -int            pthread_attr_getstacksize(const pthread_attr_t *, size_t *)
> -                       __nonnull_all;
> +                       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_getstackaddr(const pthread_attr_t *, void **);
> -int            pthread_attr_getdetachstate(const pthread_attr_t *, int *)
> -                       __nonnull_all;
> -int            pthread_attr_init(pthread_attr_t *) __nonnull(1);
> -int            pthread_attr_setstacksize(pthread_attr_t *, size_t)
> -                       __nonnull(1);
> -int            pthread_attr_setguardsize(pthread_attr_t *, size_t)
> -                       __nonnull(1);
> -int            pthread_attr_setstack(pthread_attr_t *, void *, size_t)
> -                       __nonnull(1);
> +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_setstackaddr(pthread_attr_t *, void *);
> -int            pthread_attr_setdetachstate(pthread_attr_t *, int) __nonnull(1);
> +int            pthread_attr_setdetachstate(pthread_attr_t *, int);
>  int            pthread_barrier_destroy(pthread_barrier_t *);
>  int            pthread_barrier_init(pthread_barrier_t *,
>                         const pthread_barrierattr_t *, unsigned);
> @@ -173,7 +167,7 @@ int         pthread_barrier_wait(pthread_barrie
>  int            pthread_barrierattr_destroy(pthread_barrierattr_t *);
>  int            pthread_barrierattr_getpshared(const pthread_barrierattr_t *,
>                         int *);
> -int            pthread_barrierattr_init(pthread_barrierattr_t *) __nonnull(1);
> +int            pthread_barrierattr_init(pthread_barrierattr_t *);
>  int            pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
>
>  #define                pthread_cleanup_push(cleanup_routine, cleanup_arg)              \
> @@ -189,111 +183,100 @@ int             pthread_barrierattr_setpshared(pthr
>                         __pthread_cleanup_pop_imp(execute);                     \
>                 }
>
> -int            pthread_condattr_destroy(pthread_condattr_t *) __nonnull(1);
> +int            pthread_condattr_destroy(pthread_condattr_t *);
>  int            pthread_condattr_getclock(const pthread_condattr_t *,
> -                       clockid_t *) __nonnull_all;
> -int            pthread_condattr_getpshared(const pthread_condattr_t *, int *)
> -                       __nonnull_all;
> -int            pthread_condattr_init(pthread_condattr_t *) __nonnull(1);
> -int            pthread_condattr_setclock(pthread_condattr_t *, clockid_t)
> -                       __nonnull(1);
> -int            pthread_condattr_setpshared(pthread_condattr_t *, int)
> -                       __nonnull(1);
> -int            pthread_cond_broadcast(pthread_cond_t *)
> -                       __nonnull(1);
> -int            pthread_cond_destroy(pthread_cond_t *)
> -                       __nonnull(1);
> +                       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 *,
> -                       const pthread_condattr_t *) __nonnull(1);
> -int            pthread_cond_signal(pthread_cond_t *) __nonnull(1);
> +                       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 *)
> -                       __nonnull_all __requires_exclusive(*__mutex);
> +                   __requires_exclusive(*__mutex);
>  int            pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *__mutex)
> -                       __nonnull_all __requires_exclusive(*__mutex);
> +                   __requires_exclusive(*__mutex);
>  int            pthread_create(pthread_t *, const pthread_attr_t *,
> -                       void *(*) (void *), void *) __nonnull(1) __nonnull(3);
> +                       void *(*) (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 *) __nonnull(2);
> +int            pthread_getcpuclockid(pthread_t, clockid_t *);
>  int            pthread_join(pthread_t, void **);
>  int            pthread_key_create(pthread_key_t *,
> -                       void (*) (void *)) __nonnull(1);
> +                       void (*) (void *));
>  int            pthread_key_delete(pthread_key_t);
> -int            pthread_mutexattr_init(pthread_mutexattr_t *) __nonnull(1);
> -int            pthread_mutexattr_destroy(pthread_mutexattr_t *) __nonnull(1);
> +int            pthread_mutexattr_init(pthread_mutexattr_t *);
> +int            pthread_mutexattr_destroy(pthread_mutexattr_t *);
>  int            pthread_mutexattr_getpshared(const pthread_mutexattr_t *,
> -                       int *) __nonnull_all;
> -int            pthread_mutexattr_gettype(pthread_mutexattr_t *, int *)
> -                       __nonnull_all;
> -int            pthread_mutexattr_settype(pthread_mutexattr_t *, int)
> -                       __nonnull(1);
> -int            pthread_mutexattr_setpshared(pthread_mutexattr_t *, int)
> -                       __nonnull(1);
> +                       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)
> -                       __nonnull(1) __requires_unlocked(*__mutex);
> +                   __requires_unlocked(*__mutex);
>  int            pthread_mutex_init(pthread_mutex_t *__mutex,
>                         const pthread_mutexattr_t *)
> -                       __nonnull(1) __requires_unlocked(*__mutex);
> +                   __requires_unlocked(*__mutex);
>  int            pthread_mutex_lock(pthread_mutex_t *__mutex)
> -                       __nonnull(1) __locks_exclusive(*__mutex);
> +                    __locks_exclusive(*__mutex);
>  int            pthread_mutex_trylock(pthread_mutex_t *__mutex)
> -                       __nonnull(1) __trylocks_exclusive(0, *__mutex);
> +                    __trylocks_exclusive(0, *__mutex);
>  int            pthread_mutex_timedlock(pthread_mutex_t *__mutex,
>                         const struct timespec *)
> -                       __nonnull_all __trylocks_exclusive(0, *__mutex);
> +                    __trylocks_exclusive(0, *__mutex);
>  int            pthread_mutex_unlock(pthread_mutex_t *__mutex)
> -                       __nonnull(1) __unlocks(*__mutex);
> -int            pthread_once(pthread_once_t *, void (*) (void)) __nonnull_all;
> +                   __unlocks(*__mutex);
> +int            pthread_once(pthread_once_t *, void (*) (void));
>  int            pthread_rwlock_destroy(pthread_rwlock_t *__rwlock)
> -                       __nonnull(1) __requires_unlocked(*__rwlock);
> +                   __requires_unlocked(*__rwlock);
>  int            pthread_rwlock_init(pthread_rwlock_t *__rwlock,
>                         const pthread_rwlockattr_t *)
> -                       __nonnull(1) __requires_unlocked(*__rwlock);
> +                   __requires_unlocked(*__rwlock);
>  int            pthread_rwlock_rdlock(pthread_rwlock_t *__rwlock)
> -                       __nonnull(1) __locks_shared(*__rwlock);
> +                    __locks_shared(*__rwlock);
>  int            pthread_rwlock_timedrdlock(pthread_rwlock_t *__rwlock,
>                         const struct timespec *)
> -                       __nonnull_all __trylocks_shared(0, *__rwlock);
> +                    __trylocks_shared(0, *__rwlock);
>  int            pthread_rwlock_timedwrlock(pthread_rwlock_t *__rwlock,
>                         const struct timespec *)
> -                       __nonnull_all __trylocks_exclusive(0, *__rwlock);
> +                    __trylocks_exclusive(0, *__rwlock);
>  int            pthread_rwlock_tryrdlock(pthread_rwlock_t *__rwlock)
> -                       __nonnull(1) __trylocks_shared(0, *__rwlock);
> +                    __trylocks_shared(0, *__rwlock);
>  int            pthread_rwlock_trywrlock(pthread_rwlock_t *__rwlock)
> -                       __nonnull(1) __trylocks_exclusive(0, *__rwlock);
> +                    __trylocks_exclusive(0, *__rwlock);
>  int            pthread_rwlock_unlock(pthread_rwlock_t *__rwlock)
> -                       __nonnull(1) __unlocks(*__rwlock);
> +                   __unlocks(*__rwlock);
>  int            pthread_rwlock_wrlock(pthread_rwlock_t *__rwlock)
> -                       __nonnull(1) __locks_exclusive(*__rwlock);
> -int            pthread_rwlockattr_destroy(pthread_rwlockattr_t *)
> -                       __nonnull(1);
> +                    __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 *) __nonnull_all;
> -int            pthread_rwlockattr_init(pthread_rwlockattr_t *)
> -                       __nonnull(1);
> +                       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)
> -                       __nonnull(1);
> +int            pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
>  pthread_t      pthread_self(void);
>  int            pthread_setspecific(pthread_key_t, const void *);
>
>  int            pthread_spin_init(pthread_spinlock_t *__spin, int)
> -                       __requires_unlocked(*__spin);
> +                   __requires_unlocked(*__spin);
>  int            pthread_spin_destroy(pthread_spinlock_t *__spin)
> -                       __requires_unlocked(*__spin);
> +                   __requires_unlocked(*__spin);
>  int            pthread_spin_lock(pthread_spinlock_t *__spin)
> -                       __locks_exclusive(*__spin);
> +                    __locks_exclusive(*__spin);
>  int            pthread_spin_trylock(pthread_spinlock_t *__spin)
> -                       __trylocks_exclusive(0, *__spin);
> +                    __trylocks_exclusive(0, *__spin);
>  int            pthread_spin_unlock(pthread_spinlock_t *__spin)
> -                       __unlocks(*__spin);
> +                   __unlocks(*__spin);
>  int            pthread_cancel(pthread_t);
>  int            pthread_setcancelstate(int, int *);
>  int            pthread_setcanceltype(int, int *);
> @@ -322,20 +305,18 @@ int               pthread_mutexattr_setrobust(pthread
>
>  int            pthread_attr_getinheritsched(const pthread_attr_t *, int *);
>  int            pthread_attr_getschedparam(const pthread_attr_t *,
> -                       struct sched_param *) __nonnull_all;
> -int            pthread_attr_getschedpolicy(const pthread_attr_t *, int *)
> -                       __nonnull_all;
> -int            pthread_attr_getscope(const pthread_attr_t *, int *)
> -                       __nonnull_all;
> +                       struct sched_param *);
> +int            pthread_attr_getschedpolicy(const pthread_attr_t *, int *);
> +int            pthread_attr_getscope(const pthread_attr_t *, int *);
>  int            pthread_attr_setinheritsched(pthread_attr_t *, int);
>  int            pthread_attr_setschedparam(pthread_attr_t *,
> -                       const struct sched_param *) __nonnull(1) __nonnull(2);
> -int            pthread_attr_setschedpolicy(pthread_attr_t *, int) __nonnull(1);
> -int            pthread_attr_setscope(pthread_attr_t *, int) __nonnull(1);
> +                       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 *) __nonnull(2) __nonnull(3);
> +                       struct sched_param *);
>  int            pthread_setschedparam(pthread_t, int,
> -                       const struct sched_param *) __nonnull(3);
> +                       const struct sched_param *);
>  #if __XSI_VISIBLE
>  int            pthread_getconcurrency(void);
>  int            pthread_setconcurrency(int);
>
> Modified: head/include/signal.h
> ==============================================================================
> --- head/include/signal.h       Sun Jan  1 12:35:41 2017        (r311011)
> +++ head/include/signal.h       Sun Jan  1 17:16:47 2017        (r311012)
> @@ -82,10 +82,10 @@ int sigdelset(sigset_t *, int);
>  int    sigemptyset(sigset_t *);
>  int    sigfillset(sigset_t *);
>  int    sigismember(const sigset_t *, int);
> -int    sigpending(sigset_t *) __nonnull(1);
> +int    sigpending(sigset_t *);
>  int    sigprocmask(int, const sigset_t * __restrict, sigset_t * __restrict);
> -int    sigsuspend(const sigset_t *) __nonnull(1);
> -int    sigwait(const sigset_t * __restrict, int * __restrict) __nonnull_all;
> +int    sigsuspend(const sigset_t *);
> +int    sigwait(const sigset_t * __restrict, int * __restrict);
>  #endif
>
>  #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 600
>
> Modified: head/include/stdlib.h
> ==============================================================================
> --- head/include/stdlib.h       Sun Jan  1 12:35:41 2017        (r311011)
> +++ head/include/stdlib.h       Sun Jan  1 17:16:47 2017        (r311012)
> @@ -172,7 +172,7 @@ char        *realpath(const char * __restrict,
>  int     rand_r(unsigned *);                    /* (TSF) */
>  #endif
>  #if __POSIX_VISIBLE >= 200112
> -int     posix_memalign(void **, size_t, size_t) __nonnull(1); /* (ADV) */
> +int     posix_memalign(void **, size_t, size_t); /* (ADV) */
>  int     setenv(const char *, const char *, int);
>  int     unsetenv(const char *);
>  #endif
>