From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21806 invoked by alias); 14 Feb 2019 15:34:30 -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 21798 invoked by uid 89); 14 Feb 2019 15:34:30 -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 autolearn=ham version=3.3.2 spammy=structs X-HELO: mail-wm1-f66.google.com Received: from mail-wm1-f66.google.com (HELO mail-wm1-f66.google.com) (209.85.128.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Feb 2019 15:34:29 +0000 Received: by mail-wm1-f66.google.com with SMTP id t200so6544596wmt.0 for ; Thu, 14 Feb 2019 07:34:28 -0800 (PST) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:75e6:857f:3506:a1f4? ([2001:8a0:f913:f700:75e6:857f:3506:a1f4]) by smtp.gmail.com with ESMTPSA id x3sm2971069wrd.19.2019.02.14.07.34.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 07:34:26 -0800 (PST) Subject: Re: [PATCH 00/20] Remove cleanups To: John Baldwin , Tom Tromey , gdb-patches@sourceware.org References: <20190213212927.9474-1-tom@tromey.com> <75686c17-b637-2403-09ab-b362d85a9c04@FreeBSD.org> From: Pedro Alves Message-ID: <036248fe-262d-88f5-f51b-fdabc917c077@redhat.com> Date: Thu, 14 Feb 2019 15:34:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <75686c17-b637-2403-09ab-b362d85a9c04@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-02/txt/msg00231.txt.bz2 On 02/13/2019 09:48 PM, John Baldwin wrote: > On 2/13/19 1:29 PM, Tom Tromey wrote: >> This series removes the remaining uses of make_cleanup from the tree, >> then removes make_cleanup and some related functions (but note that >> final cleanups remain). >> >> Then, it removes the TRY/CATCH macros in favor of ordinary C++ code. >> >> Finally, it cleans up a few spots that currently use TRY/CATCH but >> that are more succinctly written using SCOPE_EXIT or RAII. >> >> Regression tested by the buildbot. > > Yay! > > The only comment I have is that the structure names for exceptions look a > bit awkward in code now with the mix of lower and upper case, e.g.: > > try > { > e_msg = ada_exception_message_1 (); > } > catch (struct gdb_exception_RETURN_MASK_ERROR &e) > { > e_msg.reset (nullptr); > } > > We could drop the 'struct' perhaps, but not sure if we could simplify the > classes a bit to something like: > > struct gdb_exception_error : public gdb_exception > { > }; > > struct gdb_exception_quit : public gdb_exception > { > }; > > And use 'gdb_execption' instead of 'struct gdb_exception_RETURN_MASK_ALL', > 'gdb_exception_error' instead of 'struct gdb_exception_RETURN_MASK_ERROR', > and 'gdb_exception_quit' instead of 'struct gdb_exception_RETURN_MASK_QUIT'? Yes please. The only reason I originally named those structs that way was to make the CATCH macro simpler to map in the C++ variant: #define CATCH(EXCEPTION, MASK) \ } while (0); \ } \ catch (struct gdb_exception ## _ ## MASK &EXCEPTION) We should also catch by const reference, IMO. Is there a good reason for the non-const-ness? Thanks, Pedro Alves