From patchwork Thu May 1 20:12:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 782 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx20.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 7B312360068 for ; Thu, 1 May 2014 13:12:15 -0700 (PDT) Received: by homiemail-mx20.g.dreamhost.com (Postfix, from userid 14307373) id 30A4F41589366; Thu, 1 May 2014 13:12:15 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx20.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx20.g.dreamhost.com (Postfix) with ESMTPS id 101374158934D for ; Thu, 1 May 2014 13:12:15 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:content-type :content-transfer-encoding:from:to:subject:message-id:date; q= dns; s=default; b=fNeK8qZFtBvW5jiR0zDMjvCDDYxRUM4ghHMGFefS7z3UL5 zXChaSOZ1WCfKwtlb6A6GMeMJyQORF/3WGV2X+DuHSJvNVMN2E0+CkI4M8Sa6Kor UnVbYGdppo6I6RH5b4ildw2HvufRk2fLdf148rca3SdpOGyUzmKJw3R4sZM3I= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:content-type :content-transfer-encoding:from:to:subject:message-id:date; s= default; bh=alszwZQmTFvdyH5qUbX9X81at5w=; b=TJYfqNY3Kgvle1nZdPMS XJFShgSYQNVBVlkv0O8Afs24qRyANCbrYphVeC3XkcAZNKwi76w26mPwLE+MVCuo N9WcrqD264FyBYiEKwTa6VgkdMtMmMT8YP87zdRMvw/Y+I01xKPMU72W/NbDCWwm sBtFjBkUQBE/v2rxkD6zPwY= Received: (qmail 24381 invoked by alias); 1 May 2014 20:12:13 -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 24368 invoked by uid 89); 1 May 2014 20:12:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 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] Deconditionalize use of LLL_LOCK_INITIALIZER in bits/libc-lock.h. Message-Id: <20140501201209.E228A2C3A13@topped-with-meat.com> Date: Thu, 1 May 2014 13:12:09 -0700 (PDT) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=J405smXS c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=xLBzdwmuV9YA:10 a=Z6MIti7PxpgA:10 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=5PacA8Oh0FrxyNQlsCkA:9 a=CjuIK1q_8ugA:10 X-DH-Original-To: glibc@patchwork.siddhesh.in This was an old attempt at microoptimization that has been superfluous for some years (i.e. GCC versions). -Wundef warned us that it was in fact working by luck (LLL_LOCK_INITIALIZER was not defined at the time of its use in #if, but it so happens that in all configurations its actual correct value was zero anyway). I had thought that deconditionalizing it would reveal a real compile error with LLL_LOCK_INITIALIZER not being defined. But it did not, so evidently all the users were including lowlevellock.h afterwards by some other means. (I have not investigated further.) Build-tested on x86_64-linux-gnu, i686-linux-gnu, arm-linux-gnueabihf. Thanks, Roland 2014-05-01 Roland McGrath * nptl/sysdeps/pthread/bits/libc-lock.h [_LIBC && (!NOT_IN_libc || IS_IN_libpthread)] (__libc_lock_define_initialized_recursive): Always define using initializer. Modern compilers treat uninitialized (implicit zero) and explicit zero initializers the same (i.e. put the datum in bss). --- a/nptl/sysdeps/pthread/bits/libc-lock.h +++ b/nptl/sysdeps/pthread/bits/libc-lock.h @@ -48,13 +48,8 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; /* Define an initialized recursive lock variable NAME with storage class CLASS. */ #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) -# if LLL_LOCK_INITIALIZER == 0 -# define __libc_lock_define_initialized_recursive(CLASS,NAME) \ - CLASS __libc_lock_recursive_t NAME; -# else -# define __libc_lock_define_initialized_recursive(CLASS,NAME) \ +# define __libc_lock_define_initialized_recursive(CLASS, NAME) \ CLASS __libc_lock_recursive_t NAME = _LIBC_LOCK_RECURSIVE_INITIALIZER; -# endif # define _LIBC_LOCK_RECURSIVE_INITIALIZER \ { LLL_LOCK_INITIALIZER, 0, NULL } #else