From patchwork Wed Mar 6 14:59:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 31737 Received: (qmail 43180 invoked by alias); 6 Mar 2019 14:59:12 -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 43166 invoked by uid 89); 6 Mar 2019 14:59:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=arranging, HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Mar 2019 14:59:10 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 464C95615B; Wed, 6 Mar 2019 09:59:09 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id yZfqHlGOwfN2; Wed, 6 Mar 2019 09:59:09 -0500 (EST) Received: from murgatroyd.Home (75-166-85-218.hlrn.qwest.net [75.166.85.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id E6D5156158; Wed, 6 Mar 2019 09:59:08 -0500 (EST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [FYI] Fix remote-sim.c build after warn-unused-result change Date: Wed, 6 Mar 2019 07:59:07 -0700 Message-Id: <20190306145907.23396-1-tromey@adacore.com> MIME-Version: 1.0 John Darrington pointed out that commit 18cb7c9f3 ("Introduce ATTRIBUTE_UNUSED_RESULT and use it") broke the build: /home/john/binutils-gdb/gdb/remote-sim.c: In function 'void gdbsim_target_open(const char*, int)': /home/john/binutils-gdb/gdb/remote-sim.c:765:18: error: ignoring return value of 'char** gdb_argv::release()', declared with attribute warn_unused_result [-Werror=unused-result] This patch fixes the problem by arranging to use the result of the release method. Tested by rebuilding with a simulator enabled. gdb/ChangeLog 2019-03-06 Tom Tromey * remote-sim.c (gdbsim_target_open): Use result of gdb_argv::release. --- gdb/ChangeLog | 5 +++++ gdb/remote-sim.c | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 2acfc715d31..bef04e6bf7c 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -751,19 +751,18 @@ gdbsim_target_open (const char *args, int from_tty) } gdb_argv argv (arg_buf); - sim_argv = argv.get (); + sim_argv = argv.release (); init_callbacks (); gdbsim_desc = sim_open (SIM_OPEN_DEBUG, &gdb_callback, exec_bfd, sim_argv); if (gdbsim_desc == 0) { + freeargv (sim_argv); sim_argv = NULL; error (_("unable to create simulator instance")); } - argv.release (); - /* Reset the pid numberings for this batch of sim instances. */ next_pid = INITIAL_PID;