[3/3] Introduce a separate debug objfile iterator

Message ID 87y337yb55.fsf@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey May 15, 2019, 3:45 p.m. UTC
  >>>>> "John" == John Marshall <John.W.Marshall@glasgow.ac.uk> writes:

John> On 3 May 2019, Tom Tromey <tom@tromey.com> wrote:
>> commit bba6afebd7fde978acb6e06a48084a694aab3b7a
>> Author: Tom Tromey <tom@tromey.com>
>> Date:   Fri May 3 17:21:36 2019 -0600
>> 
>> Remove "struct" from foreach statements
>> [snip]
>> * darwin-nat.c (thread_info_from_private_thread_info): Remove
>> "struct" from foreach.

John> This broke compilation on macOS (tested on Mojave) with both Clang and GCC (9.1.0):

Can you try the appended?  I no longer have a macOS machine to test on.

If this works for you, I will check it in.

This clashes with the normal gcc bug workaround that we do here; but I
think on macOS that probably isn't worth worrying about.

Tom
  

Comments

John Marshall May 15, 2019, 8 p.m. UTC | #1
On 15 May 2019, at 16:45, Tom Tromey <tom@tromey.com> wrote:
> John> This broke compilation on macOS (tested on Mojave) with both Clang and GCC (9.1.0):
> 
> Can you try the appended?  I no longer have a macOS machine to test on.

Yes, that does the trick.

> This clashes with the normal gcc bug workaround that we do here; but I
> think on macOS that probably isn't worth worrying about.

Possibly a C-style for loop with explicit begin()/end() would work with both, but I'd agree that it's not worth worrying about for this Darwin-only file.

Thanks,

    John
  

Patch

diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index e3368ce6471..8282ef27e61 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1706,7 +1706,7 @@  darwin_attach_pid (struct inferior *inf)
 static struct thread_info *
 thread_info_from_private_thread_info (darwin_thread_info *pti)
 {
-  for (thread_info *it : all_threads ())
+  for (struct thread_info *it : all_threads ())
     {
       darwin_thread_info *iter_pti = get_darwin_thread_info (it);