Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/3] Do not use std::move when assigning an anonymous object to a unique_ptr.
Date: Wed, 23 Nov 2016 20:08:00 -0000	[thread overview]
Message-ID: <20161123200652.89209-4-jhb@FreeBSD.org> (raw)
In-Reply-To: <20161123200652.89209-1-jhb@FreeBSD.org>

Using std::move forces an extra copy of the object.  These changes fix
-Wpessimizing-move warnings from clang.

gdb/ChangeLog:

	* gdb/ada-lang.c (create_excep_cond_exprs): Do not use 'std::move'.
	* gdb/ax-gdb.c (agent_eval_command_one): Likewise.
	(agent_eval_command_one): Likewise.
	* gdb/breakpoint.c (parse_cond_to_aexpr): Likewise.
	(parse_cmd_to_aexpr): Likewise.
	* gdb/dtrace-probe.c (dtrace_process_dof_probe): Likewise.
	* gdb/parse.c (parse_expression_for_completion): Likewise.
---
 gdb/ChangeLog      | 10 ++++++++++
 gdb/ada-lang.c     |  6 +++---
 gdb/ax-gdb.c       |  8 ++++----
 gdb/breakpoint.c   |  8 ++++----
 gdb/dtrace-probe.c |  3 +--
 gdb/parse.c        |  2 +-
 6 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 051d4ce..d331edf 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
 2016-11-23  John Baldwin  <jhb@FreeBSD.org>
 
+	* gdb/ada-lang.c (create_excep_cond_exprs): Do not use 'std::move'.
+	* gdb/ax-gdb.c (agent_eval_command_one): Likewise.
+	(agent_eval_command_one): Likewise.
+	* gdb/breakpoint.c (parse_cond_to_aexpr): Likewise.
+	(parse_cmd_to_aexpr): Likewise.
+	* gdb/dtrace-probe.c (dtrace_process_dof_probe): Likewise.
+	* gdb/parse.c (parse_expression_for_completion): Likewise.
+
+2016-11-23  John Baldwin  <jhb@FreeBSD.org>
+
 	* common/new-op.c (operator new): Mark 'noexcept'.
 	(operator new[]): Likewise.
 
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 0647a9b..78c7d6f 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12343,9 +12343,9 @@ create_excep_cond_exprs (struct ada_catchpoint *c)
 	  s = cond_string;
 	  TRY
 	    {
-	      exp = std::move (parse_exp_1 (&s, bl->address,
-					    block_for_pc (bl->address),
-					    0));
+	      exp = parse_exp_1 (&s, bl->address,
+				 block_for_pc (bl->address),
+				 0);
 	    }
 	  CATCH (e, RETURN_MASK_ERROR)
 	    {
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index cd97585..49108de 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2555,8 +2555,8 @@ agent_eval_command_one (const char *exp, int eval, CORE_ADDR pc)
   arg = exp;
   if (!eval && strcmp (arg, "$_ret") == 0)
     {
-      agent = std::move (gen_trace_for_return_address (pc, get_current_arch (),
-						       trace_string));
+      agent = gen_trace_for_return_address (pc, get_current_arch (),
+					    trace_string);
     }
   else
     {
@@ -2565,10 +2565,10 @@ agent_eval_command_one (const char *exp, int eval, CORE_ADDR pc)
       if (eval)
 	{
 	  gdb_assert (trace_string == 0);
-	  agent = std::move (gen_eval_for_expr (pc, expr.get ()));
+	  agent = gen_eval_for_expr (pc, expr.get ());
 	}
       else
-	agent = std::move (gen_trace_for_expr (pc, expr.get (), trace_string));
+	agent = gen_trace_for_expr (pc, expr.get (), trace_string);
     }
 
   ax_reqs (agent.get ());
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 67b610c..e2fcc08 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2268,7 +2268,7 @@ parse_cond_to_aexpr (CORE_ADDR scope, struct expression *cond)
      that may show up.  */
   TRY
     {
-      aexpr = std::move (gen_eval_for_expr (scope, cond));
+      aexpr = gen_eval_for_expr (scope, cond);
     }
 
   CATCH (ex, RETURN_MASK_ERROR)
@@ -2452,9 +2452,9 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
      that may show up.  */
   TRY
     {
-      aexpr = std::move (gen_printf (scope, gdbarch, 0, 0,
-				     format_start, format_end - format_start,
-				     fpieces, nargs, argvec));
+      aexpr = gen_printf (scope, gdbarch, 0, 0,
+			  format_start, format_end - format_start,
+			  fpieces, nargs, argvec);
     }
   CATCH (ex, RETURN_MASK_ERROR)
     {
diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
index 38654a4..29c2d28 100644
--- a/gdb/dtrace-probe.c
+++ b/gdb/dtrace-probe.c
@@ -430,8 +430,7 @@ dtrace_process_dof_probe (struct objfile *objfile,
 
 	  TRY
 	    {
-	      expr = std::move (parse_expression_with_language (arg.type_str,
-								language_c));
+	      expr = parse_expression_with_language (arg.type_str, language_c);
 	    }
 	  CATCH (ex, RETURN_MASK_ERROR)
 	    {
diff --git a/gdb/parse.c b/gdb/parse.c
index afafc35..323de77 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1309,7 +1309,7 @@ parse_expression_for_completion (const char *string, char **name,
   TRY
     {
       parse_completion = 1;
-      exp = std::move (parse_exp_in_context (&string, 0, 0, 0, 0, &subexp));
+      exp = parse_exp_in_context (&string, 0, 0, 0, 0, &subexp);
     }
   CATCH (except, RETURN_MASK_ERROR)
     {
-- 
2.9.2


  parent reply	other threads:[~2016-11-23 20:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-23 20:07 [PATCH 0/3] Fix various C++ related clang warnings John Baldwin
2016-11-23 20:08 ` [PATCH 1/3] Fix mismatched struct vs class tags John Baldwin
2016-11-23 20:58   ` Simon Marchi
2016-11-23 23:23     ` John Baldwin
2016-11-24 17:02       ` Pedro Alves
2016-11-24 17:47         ` John Baldwin
2016-11-24 18:50           ` Pedro Alves
2016-11-24 19:15             ` John Baldwin
2016-11-30 11:39               ` Pedro Alves
2016-11-30 16:23                 ` John Baldwin
2016-11-30 16:38                   ` Pedro Alves
2016-11-30 16:52                     ` Simon Marchi
2016-11-30 16:51                   ` Simon Marchi
2016-11-30 17:08                     ` Pedro Alves
2016-11-30 17:54                       ` Simon Marchi
2016-11-30 17:59                     ` Eli Zaretskii
2016-11-23 20:08 ` John Baldwin [this message]
2016-11-23 21:19   ` [PATCH 3/3] Do not use std::move when assigning an anonymous object to a unique_ptr Simon Marchi
2016-11-23 23:31     ` John Baldwin
2016-11-24  0:08       ` Simon Marchi
2016-11-24 16:52         ` Pedro Alves
2016-11-23 20:08 ` [PATCH 2/3] Add noexcept to custom non-throwing new operators John Baldwin
2016-11-24 17:03   ` Pedro Alves
2016-11-23 22:18 ` [PATCH 0/3] Fix various C++ related clang warnings Simon Marchi
2016-11-23 23:23   ` John Baldwin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161123200652.89209-4-jhb@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox