gdb/dwarf: Fix MinGW build

Message ID 20230410042136.351081-1-thiago.bauermann@linaro.org
State New
Headers
Series gdb/dwarf: Fix MinGW build |

Commit Message

Thiago Jung Bauermann April 10, 2023, 4:21 a.m. UTC
  Unfortunately MinGW doesn't support std::future yet, so this causes the
build to fail.  Use GDB's version which provides a fallback for this case.

Tested for regressions on native aarch64-linux.
---
 gdb/dwarf2/cooked-index.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Tom Tromey April 10, 2023, 2:37 p.m. UTC | #1
>>>>> Thiago Jung Bauermann via Gdb-patches <gdb-patches@sourceware.org> writes:

> Unfortunately MinGW doesn't support std::future yet, so this causes the
> build to fail.  Use GDB's version which provides a fallback for this case.

> Tested for regressions on native aarch64-linux.

Thanks, & sorry about that.

This doesn't fail for me using the Fedora mingw cross toolchain, I don't
know why.  Internally at AdaCore, it works fine, because we use a
version of GCC that implements std::thread for mingw.

Anyway...

Approved-By: Tom Tromey <tromey@adacore.com>

Tom
  
Thiago Jung Bauermann April 10, 2023, 11:22 p.m. UTC | #2
Tom Tromey <tromey@adacore.com> writes:

>>>>>> Thiago Jung Bauermann via Gdb-patches <gdb-patches@sourceware.org> writes:
>
>> Unfortunately MinGW doesn't support std::future yet, so this causes the
>> build to fail.  Use GDB's version which provides a fallback for this case.
>
>> Tested for regressions on native aarch64-linux.
>
> Thanks, & sorry about that.

No problem.

> This doesn't fail for me using the Fedora mingw cross toolchain, I don't
> know why.  Internally at AdaCore, it works fine, because we use a
> version of GCC that implements std::thread for mingw.

Interesting. For the record, I noticed this with gcc-mingw-w64-i686 from
Ubuntu 20.04 and 22.04, versions 9.3.0-7ubuntu1+22~exp1ubuntu4 and
10.3.0-14ubuntu1+24.3 respectively.

> Anyway...
>
> Approved-By: Tom Tromey <tromey@adacore.com>

Thanks! Committed.
  

Patch

diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h
index f2664929e521..0d6f3e5aa0ee 100644
--- a/gdb/dwarf2/cooked-index.h
+++ b/gdb/dwarf2/cooked-index.h
@@ -442,7 +442,7 @@  class cooked_index : public dwarf_scanner_base
   vec_type m_vector;
 
   /* A future that tracks when the 'index_write' method is done.  */
-  std::future<void> m_write_future;
+  gdb::future<void> m_write_future;
 };
 
 #endif /* GDB_DWARF2_COOKED_INDEX_H */