From patchwork Fri Nov 29 00:12:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 36370 Received: (qmail 111911 invoked by alias); 29 Nov 2019 00:12:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 111893 invoked by uid 89); 29 Nov 2019 00:12:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-40134.protonmail.ch Received: from mail-40134.protonmail.ch (HELO mail-40134.protonmail.ch) (185.70.40.134) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 29 Nov 2019 00:12:08 +0000 Date: Fri, 29 Nov 2019 00:12:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gdcproject.org; s=protonmail; t=1574986325; bh=nyM+aP7sey9beZYOzt52thjEUi+ElyecGdUypy+yXN0=; h=Date:To:From:Cc:Reply-To:Subject:Feedback-ID:From; b=gqaMlDXSl2t0wbtGGMiBQO093PcafF4Ow1u6mNYuwMK6e0vjG1xiC7gOaXmuBsit5 0NEXzNdw4YLWG6w5nCjMz9TYvdC6XVJ1CbSMbC51XIZiY9uwyoUlCT6b7f24ki9teR xG9qS8ZAgIOqxPWxntEbiUf0M/07Ycq/oMpIICS4= To: "gdb-patches@sourceware.org" From: Iain Buclaw Cc: Pedro Alves Reply-To: Iain Buclaw Subject: [PATCH v2 3/3] gdb: Remove unused buffer_clearer variable. Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes When reviewing how fputs_maybe_unfiltered works, I noticed that the compiler was removing this variable and assigned lambda expression as dead code. There are no early returns in this function, so release() is always called. --- Iain --- gdb/ChangeLog: 2019-11-29 Iain Buclaw * gdb/utils.c (fputs_maybe_filtered): Remove buffer_clearer variable. --- diff --git a/gdb/utils.c b/gdb/utils.c index 0e09f646bf..721babee7f 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1699,14 +1699,6 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream, return; } - auto buffer_clearer - = make_scope_exit ([&] () - { - wrap_buffer.clear (); - wrap_column = 0; - wrap_indent = ""; - }); - /* Go through and output each character. Show line extension when this is necessary; prompt user for new page when this is necessary. */ @@ -1823,8 +1815,6 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream, lineptr++; } } - - buffer_clearer.release (); } void