This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gold commit] Fix test for availability of emplace_back


Testing for the GCC version 5 or later isn't right, since C++ 11 support
wasn't enabled by default until later.  This patch tests the C++ standard
support directly instead of inferring it from the GCC version.

Nick, is this OK for the 2.31 branch?

-cary


2018-07-09  Cary Coutant  <ccoutant@gmail.com>

gold/
	* incremental.cc (Sized_incremental_binary::setup_readers): Use
	emplace_back for C++ 11 or later.


diff --git a/gold/incremental.cc b/gold/incremental.cc
index 7558d14ff5..1199fe070f 100644
--- a/gold/incremental.cc
+++ b/gold/incremental.cc
@@ -311,10 +311,10 @@ 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
+#if __cplusplus >= 2001103L
       this->input_entry_readers_.emplace_back(input_file);
+#else
+      this->input_entry_readers_.push_back(Sized_input_reader(input_file));
 #endif
       switch (input_file.type())
 	{


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]