diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2017-11-23 13:51:50 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2017-11-23 13:52:28 -0500 |
commit | f45e2a7704c738ba8195a667f910297c4155924e (patch) | |
tree | f838d2e110d1909570a202c9bfa5b62040e5a032 /gdb/osdata.c | |
parent | bd046f64a193405f2fef2d5120fab4be25feaa8b (diff) | |
download | gdb-f45e2a7704c738ba8195a667f910297c4155924e.zip gdb-f45e2a7704c738ba8195a667f910297c4155924e.tar.gz gdb-f45e2a7704c738ba8195a667f910297c4155924e.tar.bz2 |
Fix clang warnings about copy elision
When building with clang, I get:
/home/emaisin/src/binutils-gdb/gdb/osdata.c:107:9: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
std::move (std::string (body_text)));
^
/home/emaisin/src/binutils-gdb/gdb/osdata.c:107:9: note: remove std::move call here
std::move (std::string (body_text)));
^~~~~~~~~~~ ~
/home/emaisin/src/binutils-gdb/gdb/osdata.c:181:10: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move]
return std::move (osdata);
^
/home/emaisin/src/binutils-gdb/gdb/osdata.c:181:10: note: remove std::move call here
return std::move (osdata);
^~~~~~~~~~~ ~
Indeed, those two std::move are unnecessary.
gdb/ChangeLog:
* osdata.c (osdata_end_column, get_osdata): Remove std::move.
Diffstat (limited to 'gdb/osdata.c')
-rw-r--r-- | gdb/osdata.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/osdata.c b/gdb/osdata.c index f013d0f..a82cbf1 100644 --- a/gdb/osdata.c +++ b/gdb/osdata.c @@ -104,7 +104,7 @@ osdata_end_column (struct gdb_xml_parser *parser, osdata_item &item = osdata->items.back (); item.columns.emplace_back (std::move (data->property_name), - std::move (std::string (body_text))); + std::string (body_text)); } /* The allowed elements and attributes for OS data object. @@ -178,7 +178,7 @@ get_osdata (const char *type) if (osdata == NULL) error (_("Can not fetch data now.")); - return std::move (osdata); + return osdata; } const std::string * |