From patchwork Wed Jun 12 14:54:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1114604 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-502838-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="emBn/iA6"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 45P8zd4dXnz9s7h for ; Thu, 13 Jun 2019 00:54:53 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=EN4qMikHsJih/QH0/d81mxhqRqJwtjTh53FSqKoL5WNnHjBxT7 4UsF6uGx/K206cD4O9/E8vmQ+5BehNqyxgAGXZxdp/hQme2nfzvqhr4PsYwBBWPL gVC+49Cj2B1b6AKXllPEPTA03vsbTn1doIRp57VinooGpiAP+SPXiPoYM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=7a7k2sDOIOd+Xm/TgzWUCAfFOtY=; b=emBn/iA6zjjHp9dcXY/U SnqIMGbU6HXQubPGcpx8bcSGkvjXxK/yzVMv1YWLTtLrLbDgC20BV3jB924X0Tw1 Ax2o1/uXXusKGbbPQFHMVo074yP71i7R6NO4Uk1YTF0dXmLPY/gKhvazQP3Go8PK 2EMmPh7OQn0cKHLbHxdz9fE= Received: (qmail 6879 invoked by alias); 12 Jun 2019 14:54:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 6866 invoked by uid 89); 12 Jun 2019 14:54:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=owns X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Jun 2019 14:54:44 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8516230BBE75; Wed, 12 Jun 2019 14:54:43 +0000 (UTC) Received: from localhost (unknown [10.33.36.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 366A0608A6; Wed, 12 Jun 2019 14:54:43 +0000 (UTC) Date: Wed, 12 Jun 2019 15:54:42 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Lars Gullik =?iso-8859-1?q?Bj=F8nnes?= Subject: [PATCH] Simplify std::scoped_lock destructor Message-ID: <20190612145442.GA27263@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.11.3 (2019-02-01) * include/std/mutex (scoped_lock::~scoped_lock()): Use fold expression. Thanks to Lars for pointing out this could be simplified. Tested x86_64-linux, committed to trunk. commit 7445abf1ee5e14e644efd0533fff9e0c125b1d2c Author: redi Date: Wed Jun 12 14:52:06 2019 +0000 Simplify std::scoped_lock destructor * include/std/mutex (scoped_lock::~scoped_lock()): Use fold expression. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@272187 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex index ca2c669db9a..981b6725f7c 100644 --- a/libstdc++-v3/include/std/mutex +++ b/libstdc++-v3/include/std/mutex @@ -576,11 +576,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { } // calling thread owns mutex ~scoped_lock() - { - std::apply([](_MutexTypes&... __m) { - char __i[] __attribute__((__unused__)) = { (__m.unlock(), 0)... }; - }, _M_devices); - } + { std::apply([](auto&... __m) { (__m.unlock(), ...); }, _M_devices); } scoped_lock(const scoped_lock&) = delete; scoped_lock& operator=(const scoped_lock&) = delete;