summaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2018-06-22 18:19:51 -0700
committerCary Coutant <ccoutant@gmail.com>2018-06-22 18:19:51 -0700
commita1893a821c4a2e953d13b97360b85650f2127134 (patch)
tree1f388308d04c063ce8ada1ca1be3174cc6e87bbf /gold
parent2e7a29d5701d6b320cddf0b1677116d2fe49587b (diff)
downloadbinutils-gdb-a1893a821c4a2e953d13b97360b85650f2127134.tar.gz
Silence GCC 9 error about deprecated implicit copy constructor.
Replacing push_back() with emplace_back() eliminates the calls to the copy constructor, but I still had to provide explicit copy constructors because of the call to vector::reserve(), which tries to instantiate them even though they'll never actually be called when reserve() is called on an empty vector. gold/ * incremental.cc (Sized_incremental_binary::setup_readers): Use emplace_back for GCC 5 and later. * incremental.h (Incremental_binary::Input_reader): Provide copy constructor. (Sized_incremental_binary::Sized_input_reader): Likewise.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog8
-rw-r--r--gold/incremental.cc4
-rw-r--r--gold/incremental.h7
3 files changed, 19 insertions, 0 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 623eb593f26..10105137bdb 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,5 +1,13 @@
2018-06-22 Cary Coutant <ccoutant@gmail.com>
+ * incremental.cc (Sized_incremental_binary::setup_readers): Use
+ emplace_back for GCC 5 and later.
+ * incremental.h (Incremental_binary::Input_reader): Provide copy
+ constructor.
+ (Sized_incremental_binary::Sized_input_reader): Likewise.
+
+2018-06-22 Cary Coutant <ccoutant@gmail.com>
+
PR gold/22914
* layout.cc (Layout::Layout): Initialize gnu_properties_.
(read_sized_value, write_sized_value): New functions.
diff --git a/gold/incremental.cc b/gold/incremental.cc
index 21f060c945b..7558d14ff50 100644
--- a/gold/incremental.cc
+++ b/gold/incremental.cc
@@ -311,7 +311,11 @@ Sized_incremental_binary<size, big_endian>::setup_readers()
for (unsigned int i = 0; i < count; i++)
{
Input_entry_reader input_file = inputs.input_file(i);
+#if defined(__GNUC__) && __GNUC__ < 5
this->input_entry_readers_.push_back(Sized_input_reader(input_file));
+#else
+ this->input_entry_readers_.emplace_back(input_file);
+#endif
switch (input_file.type())
{
case INCREMENTAL_INPUT_OBJECT:
diff --git a/gold/incremental.h b/gold/incremental.h
index 1c3fbe1147f..b4694b33d07 100644
--- a/gold/incremental.h
+++ b/gold/incremental.h
@@ -1368,6 +1368,9 @@ class Incremental_binary
Input_reader()
{ }
+ Input_reader(const Input_reader&)
+ { }
+
virtual
~Input_reader()
{ }
@@ -1708,6 +1711,10 @@ class Sized_incremental_binary : public Incremental_binary
: Input_reader(), reader_(r)
{ }
+ Sized_input_reader(const Sized_input_reader& r)
+ : Input_reader(), reader_(r.reader_)
+ { }
+
virtual
~Sized_input_reader()
{ }