From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3259 invoked by alias); 1 Feb 2017 08:49:00 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 3244 invoked by uid 89); 1 Feb 2017 08:48:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*f:sk:7a94331, H*i:sk:7a94331, H*F:D*pl X-HELO: smtpo46.poczta.onet.pl Received: from smtpo46.poczta.onet.pl (HELO smtpo46.poczta.onet.pl) (213.180.142.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 01 Feb 2017 08:48:49 +0000 Received: from [192.168.2.253] (83-238-239-138.adsl.inetia.pl [83.238.239.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: freddie_chopin@op.pl) by smtp.poczta.onet.pl (Onet) with ESMTPSA id 3vCxcX6Dx0zTCkvys for ; Wed, 1 Feb 2017 09:48:44 +0100 (CET) Message-ID: <1485938923.1269.3.camel@op.pl> Subject: Re: [PATCH 2/3, newlib] Only define static locks in multithreaded mode From: Freddie Chopin To: newlib@sourceware.org Date: Wed, 01 Feb 2017 08:49:00 -0000 In-Reply-To: <7a943313-48e7-2c8f-7250-ce47aeecda13@foss.arm.com> References: <7a943313-48e7-2c8f-7250-ce47aeecda13@foss.arm.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00114.txt.bz2 On Tue, 2017-01-31 at 17:10 +0000, Thomas Preudhomme wrote: > It also makes sure locking macros in lock.h are noop in single thread > mode. Doesn't it make all the guards in the code superfluous? If the lock initialization macros are defined to be ";" and lock functions are defined to be "(void)0", then the guards in the code actually guard nothing, as things like: #if !defined(__SINGLE_THREAD__) && defined(HAVE_DD_LOCK)  __LOCK_INIT(static, __dd_hash_mutex);  #endif #ifndef __SINGLE_THREAD__         __lock_acquire(__dd_hash_mutex);  #endif will then be equivalent to: #if !defined(__SINGLE_THREAD__) && defined(HAVE_DD_LOCK)  ;  #endif #ifndef __SINGLE_THREAD__         (void)0;  #endif Regards, FCh