From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36587 invoked by alias); 9 Jan 2019 03:34:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 36531 invoked by uid 89); 9 Jan 2019 03:34:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1414, bespoke X-HELO: gateway23.websitewelcome.com Received: from gateway23.websitewelcome.com (HELO gateway23.websitewelcome.com) (192.185.49.219) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 Jan 2019 03:34:30 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway23.websitewelcome.com (Postfix) with ESMTP id C45E8A261 for ; Tue, 8 Jan 2019 21:34:28 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id h4dQgogbviQerh4dQgqDNr; Tue, 08 Jan 2019 21:34:28 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=4lDCaYhRnFi6uOx+g+pO+8zhc0inFhjSFsSaapR/tRo=; b=IdYZVEvqTqxSvRSIjiTCcEquk/ rxB4bBrGXtD0mJWlH+WyqRuhIg2YUdj2kGLd7UwPvyfC0zr9LrzLYSKvkUu6JpGVF7z8rCwUzX2/m 1Z132AHeOJU6tRL/ekQ2NGSfF; Received: from 75-166-72-210.hlrn.qwest.net ([75.166.72.210]:47026 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gh4dQ-000HG2-HH for gdb-patches@sourceware.org; Tue, 08 Jan 2019 21:34:28 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH 00/12] remove some cleanups using a cleanup function Date: Wed, 09 Jan 2019 03:34:00 -0000 Message-Id: <20190109033426.16062-1-tom@tromey.com> X-SW-Source: 2019-01/txt/msg00159.txt.bz2 This is the series to introduce a new cleanup_function class, that can be used in situations where a simple function call is needed to do some cleanup. As I mentioned in the other thread, I was (and still am) uncertain as to whether this is a good idea. My worry is just that this will be used in ways leading to unclear code. (You can judge for yourself whether this series has already entered that territory...) A couple of rules I used when deciding when to use the new class: * There should not be too many uses of the existing cleanup (one or two). If there are more than several it should probably be a bespoke class. * Any lambdas should capture only a small number of things (one or maybe two), and only capture by value should be used. Hopefully I actually followed these. I wonder if the new class should take a std::function rather than a gdb::function_view. Some of the changes needs a bit of extra code to deal with the latter. Also I wonder if it should be possible to default-construct a cleanup_function, and then set it later. This would eliminate some uses of gdb::optional; and seemed maybe reasonable given that the class already has to maintain a (sort of-) validity flag. This series includes a couple of cleanup-related comment fixes for things I happened to notice along the way. Regression tested by the buildbot. Tom