[gdb/build] Fix missing implicit constructor call with gcc 4.8
authorTom de Vries <tdevries@suse.de>
Sat, 8 Aug 2020 21:34:19 +0000 (23:34 +0200)
committerTom de Vries <tdevries@suse.de>
Sat, 8 Aug 2020 21:34:19 +0000 (23:34 +0200)
commit38f8aa06d9c422934e635779783107c0d3be419a
treed1fa5acfabf19f93827184c184f70ae214675c00
parentbc853409cc6887e9d9ea9279b0c2b7e4ccdf230e
[gdb/build] Fix missing implicit constructor call with gcc 4.8

When building gdb on x86_64-linux with --enable-targets riscv64-suse-linux, I
run into:
...
src/gdb/arch/riscv.c:112:45:   required from here
/usr/include/c++/4.8/bits/hashtable_policy.h:195:39: error: no matching \
  function for call to 'std::pair<const riscv_gdbarch_features, const \
  std::unique_ptr<target_desc, target_desc_deleter> >::pair(const \
  riscv_gdbarch_features&, target_desc*&)'
  : _M_v(std::forward<_Args>(__args)...) { }
                                       ^
...
for this code in riscv_lookup_target_description:
...
  /* Add to the cache.  */
  riscv_tdesc_cache.emplace (features, tdesc);
...

Work around this compiler problem (filed as PR gcc/96537), similar to how that
was done in commit 6d0cf4464e "Fix build with gcc-4.8.x":
...
-  riscv_tdesc_cache.emplace (features, tdesc);
+  riscv_tdesc_cache.emplace (features, target_desc_up (tdesc));
...
That is, call the target_desc_up constructor explictly instead of implicitly.

Also, work around a similar issue in get_thread_arch_aspace_regcache.

Build on x86_64-linux with --enable-targets riscv64-suse-linux, and
reg-tested.

gdb/ChangeLog:

2020-08-08  Tom de Vries  <tdevries@suse.de>

PR build/26344
* arch/riscv.c (riscv_lookup_target_description): Use an explicit
constructor.
* regcache.c (get_thread_arch_aspace_regcache): Same.
gdb/ChangeLog
gdb/arch/riscv.c
gdb/regcache.c