From patchwork Mon Oct 20 21:15:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 3293 Received: (qmail 28986 invoked by alias); 20 Oct 2014 21:15:21 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 28976 invoked by uid 89); 20 Oct 2014 21:15:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: topped-with-meat.com MIME-Version: 1.0 From: Roland McGrath To: "GNU C. Library" Subject: [COMMITTED PATCH] Make internal lock-init macros return void. Message-Id: <20141020211518.022202C3B05@topped-with-meat.com> Date: Mon, 20 Oct 2014 14:15:17 -0700 (PDT) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=SvUDtp+0 c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=Z6MIti7PxpgA:10 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=ixtXmvoTDz4F5o6Oz0IA:9 a=CjuIK1q_8ugA:10 GCC 4.9 gives warnings about ", 0" expressions when the whole expression's value is not used. This hits in some of our lock-init macros. But they are already used as if they returned void, and some others actually do (i.e. are statements, not expressions). This has no effect on generated code. Thanks, Roland 2014-10-20 Roland McGrath * sysdeps/nptl/bits/libc-lock.h [_LIBC && (!NOT_IN_libc || IS_IN_libpthread)] (__libc_lock_init_recursive): Return void, not 0. * sysdeps/nptl/bits/libc-lockP.h (__libc_lock_init): Likewise. (__libc_rwlock_init): Likewise. * sysdeps/nptl/bits/stdio-lock.h (_IO_lock_init): Likewise. --- a/sysdeps/nptl/bits/libc-lock.h +++ b/sysdeps/nptl/bits/libc-lock.h @@ -62,7 +62,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; /* Initialize a recursive mutex. */ #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) # define __libc_lock_init_recursive(NAME) \ - ((NAME) = (__libc_lock_recursive_t) _LIBC_LOCK_RECURSIVE_INITIALIZER, 0) + ((void) ((NAME) = (__libc_lock_recursive_t) _LIBC_LOCK_RECURSIVE_INITIALIZER)) #else # define __libc_lock_init_recursive(NAME) \ do { \ --- a/sysdeps/nptl/bits/libc-lockP.h +++ b/sysdeps/nptl/bits/libc-lockP.h @@ -126,16 +126,16 @@ typedef pthread_key_t __libc_key_t; /* Initialize the named lock variable, leaving it in a consistent, unlocked state. */ #if !defined NOT_IN_libc || defined IS_IN_libpthread -# define __libc_lock_init(NAME) ((NAME) = LLL_LOCK_INITIALIZER, 0) +# define __libc_lock_init(NAME) \ + ((void) ((NAME) = LLL_LOCK_INITIALIZER)) #else # define __libc_lock_init(NAME) \ __libc_maybe_call (__pthread_mutex_init, (&(NAME), NULL), 0) #endif #if defined SHARED && !defined NOT_IN_libc -/* ((NAME) = (__libc_rwlock_t) PTHREAD_RWLOCK_INITIALIZER, 0) is - inefficient. */ +/* ((NAME) = (__libc_rwlock_t) PTHREAD_RWLOCK_INITIALIZER) is inefficient. */ # define __libc_rwlock_init(NAME) \ - (__builtin_memset (&(NAME), '\0', sizeof (NAME)), 0) + ((void) __builtin_memset (&(NAME), '\0', sizeof (NAME))) #else # define __libc_rwlock_init(NAME) \ __libc_maybe_call (__pthread_rwlock_init, (&(NAME), NULL), 0) --- a/sysdeps/nptl/bits/stdio-lock.h +++ b/sysdeps/nptl/bits/stdio-lock.h @@ -31,7 +31,7 @@ typedef struct { int lock; int cnt; void *owner; } _IO_lock_t; #define _IO_lock_initializer { LLL_LOCK_INITIALIZER, 0, NULL } #define _IO_lock_init(_name) \ - ((_name) = (_IO_lock_t) _IO_lock_initializer , 0) + ((void) ((_name) = (_IO_lock_t) _IO_lock_initializer)) #define _IO_lock_fini(_name) \ ((void) 0)