This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[pushed] Fix build with g++ 6.3.1


FYI, I've pushed this patch from Adam, which he attached to
PR c++/21222, fixing yet another case of g++ 6.3.1's troubles
with range-for:
  https://sourceware.org/ml/gdb-patches/2017-10/msg00442.html

>From 23a8d1862b7e5b95f0fe9d724c6be326e545e6d1 Mon Sep 17 00:00:00 2001
From: Adam Stylinski <adam.stylinski@etegent.com>
Date: Thu, 7 Dec 2017 12:51:03 -0500
Subject: [PATCH] Fix build with g++ 6.3.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

With g++ 6.3.1:

 target-descriptions.c: In member function ‘virtual void
 print_c_tdesc::visit_pre(const target_desc*)’:
 target-descriptions.c:1836:16: error: types may not be defined in a
 for-range-declaration [-Werror]
      for (const struct bfd_arch_info *compatible : e->compatible)
		 ^~~~~~

I think at some point the forward declaration of this struct had been
removed and declared as a typedef.  This fixes that.

gdb/ChangeLog:
2017-12-07  Adam Stylinski  <adam.stylinski@etegent.com>

	PR c++/21222
	* target-descriptions.c (print_c_tdesc::visit_pre): Change type of
	range-for variable.
---
 gdb/ChangeLog             | 6 ++++++
 gdb/target-descriptions.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 54aec7f..8344f6e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2017-12-07  Adam Stylinski  <adam.stylinski@etegent.com>
+
+	PR c++/21222
+	* target-descriptions.c (print_c_tdesc::visit_pre): Change type of
+	range-for variable.
+
 2017-12-07  Simon Marchi  <simon.marchi@ericsson.com>
 
 	* common/selftest.h (struct selftest): Add virtual destructor.
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 5a6f619..88ac55f 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1833,7 +1833,7 @@ public:
 	printf_unfiltered ("\n");
       }
 
-    for (const struct bfd_arch_info *compatible : e->compatible)
+    for (const bfd_arch_info_type *compatible : e->compatible)
       printf_unfiltered
 	("  tdesc_add_compatible (result, bfd_scan_arch (\"%s\"));\n",
 	 compatible->printable_name);
-- 
2.5.5


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