* [PATCH 1/2] gdbsupport: use result_of_t instead of result_of in parallel-for.h
@ 2022-04-12 16:30 Simon Marchi
2022-04-12 16:30 ` [PATCH 2/2] gdb: use decltype instead of typeof in dwarf2/read.c Simon Marchi
2022-04-12 17:36 ` [PATCH 1/2] gdbsupport: use result_of_t instead of result_of in parallel-for.h Tom Tromey
0 siblings, 2 replies; 5+ messages in thread
From: Simon Marchi @ 2022-04-12 16:30 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
When building with -std=c++11, I get:
In file included from /home/smarchi/src/binutils-gdb/gdb/unittests/parallel-for-selftests.c:22: /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/parallel-for.h:134:10: error: ‘result_of_t’ is not a member of ‘std’; did you mean ‘result_of’?
134 | std::result_of_t<RangeFunction (RandomIt, RandomIt)>
| ^~~~~~~~~~~
| result_of
This is because result_of_t has been introduced in C++14. Use the
equivalent result_of<...>::type instead.
result_of and result_of_t have been removed in C++20 though, so I think
we'll need some patches eventually to make the code use invoke_result
instead, depending on the C++ version.
Change-Id: I4817f361c0ebcdd4b32976898fc368bb302b61b9
---
gdbsupport/parallel-for.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gdbsupport/parallel-for.h b/gdbsupport/parallel-for.h
index 44303abb716..713ec660306 100644
--- a/gdbsupport/parallel-for.h
+++ b/gdbsupport/parallel-for.h
@@ -131,13 +131,13 @@ struct par_for_accumulator<void>
template<class RandomIt, class RangeFunction>
typename gdb::detail::par_for_accumulator<
- std::result_of_t<RangeFunction (RandomIt, RandomIt)>
+ typename std::result_of<RangeFunction (RandomIt, RandomIt)>::type
>::result_type
parallel_for_each (unsigned n, RandomIt first, RandomIt last,
RangeFunction callback)
{
- typedef typename std::result_of_t<RangeFunction (RandomIt, RandomIt)>
- result_type;
+ using result_type
+ = typename std::result_of<RangeFunction (RandomIt, RandomIt)>::type;
size_t n_threads = thread_pool::g_thread_pool->thread_count ();
size_t n_elements = last - first;
--
2.35.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] gdb: use decltype instead of typeof in dwarf2/read.c
2022-04-12 16:30 [PATCH 1/2] gdbsupport: use result_of_t instead of result_of in parallel-for.h Simon Marchi
@ 2022-04-12 16:30 ` Simon Marchi
2022-04-12 17:37 ` Tom Tromey
2022-04-12 17:36 ` [PATCH 1/2] gdbsupport: use result_of_t instead of result_of in parallel-for.h Tom Tromey
1 sibling, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2022-04-12 16:30 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
When building with -std=c++11, I get:
CXX dwarf2/read.o
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c: In function ‘void dwarf2_build_psymtabs_hard(dwarf2_per_objfile*)’:
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:7130:23: error: expected type-specifier before ‘typeof’
7130 | using iter_type = typeof (per_bfd->all_comp_units.begin ());
| ^~~~~~
This is because typeof is a GNU extension. Use C++'s decltype keyword
instead.
Change-Id: Ieca2e8d25e50f71dc6c615a405a972a54de3ef14
---
gdb/dwarf2/read.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 9e8527a7fc1..7c148aecdf5 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -7127,7 +7127,7 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile)
/* Ensure that complaints are handled correctly. */
complaint_interceptor complaint_handler;
- using iter_type = typeof (per_bfd->all_comp_units.begin ());
+ using iter_type = decltype (per_bfd->all_comp_units.begin ());
/* Each thread returns a pair holding a cooked index, and a vector
of errors that should be printed. The latter is done because
--
2.35.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] gdbsupport: use result_of_t instead of result_of in parallel-for.h
2022-04-12 16:30 [PATCH 1/2] gdbsupport: use result_of_t instead of result_of in parallel-for.h Simon Marchi
2022-04-12 16:30 ` [PATCH 2/2] gdb: use decltype instead of typeof in dwarf2/read.c Simon Marchi
@ 2022-04-12 17:36 ` Tom Tromey
2022-04-12 18:12 ` Simon Marchi
1 sibling, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2022-04-12 17:36 UTC (permalink / raw)
To: Simon Marchi via Gdb-patches; +Cc: Simon Marchi
>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
Simon> This is because result_of_t has been introduced in C++14. Use the
Simon> equivalent result_of<...>::type instead.
Thank you, please check this in.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] gdb: use decltype instead of typeof in dwarf2/read.c
2022-04-12 16:30 ` [PATCH 2/2] gdb: use decltype instead of typeof in dwarf2/read.c Simon Marchi
@ 2022-04-12 17:37 ` Tom Tromey
0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2022-04-12 17:37 UTC (permalink / raw)
To: Simon Marchi via Gdb-patches; +Cc: Simon Marchi
>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
Simon> This is because typeof is a GNU extension. Use C++'s decltype keyword
Simon> instead.
Ugh, sorry about that. Please check this in.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] gdbsupport: use result_of_t instead of result_of in parallel-for.h
2022-04-12 17:36 ` [PATCH 1/2] gdbsupport: use result_of_t instead of result_of in parallel-for.h Tom Tromey
@ 2022-04-12 18:12 ` Simon Marchi
0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2022-04-12 18:12 UTC (permalink / raw)
To: Tom Tromey, Simon Marchi via Gdb-patches; +Cc: Simon Marchi
On 2022-04-12 13:36, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Simon> This is because result_of_t has been introduced in C++14. Use the
> Simon> equivalent result_of<...>::type instead.
>
> Thank you, please check this in.
>
> Tom
Pushed both patches, thanks.
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-12 18:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12 16:30 [PATCH 1/2] gdbsupport: use result_of_t instead of result_of in parallel-for.h Simon Marchi
2022-04-12 16:30 ` [PATCH 2/2] gdb: use decltype instead of typeof in dwarf2/read.c Simon Marchi
2022-04-12 17:37 ` Tom Tromey
2022-04-12 17:36 ` [PATCH 1/2] gdbsupport: use result_of_t instead of result_of in parallel-for.h Tom Tromey
2022-04-12 18:12 ` Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).