* [PATCH 1/2] gdb: fix ia64-tdep.c build with g++ 4.8
@ 2021-11-18 20:50 Simon Marchi
2021-11-18 20:50 ` [PATCH 2/2] gdb: fix array-view-selftests.c " Simon Marchi
0 siblings, 1 reply; 4+ messages in thread
From: Simon Marchi @ 2021-11-18 20:50 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
When building with g++ 4.8, I get:
CXX ia64-tdep.o
/home/smarchi/src/binutils-gdb/gdb/ia64-tdep.c:3862:1: error: could not convert '{ia64_allocate_new_rse_frame, ia64_store_argument_in_slot, ia64_set_function_addr}' from '<brace
-enclosed initializer list>' to 'const ia64_infcall_ops'
};
^
This happens since commit 345bd07cce3 ("gdb: fix gdbarch_tdep ODR
violation"), which added default values for ia64_infcall_ops fields. It
looks like g++ 4.8 doesn't like initializing the ia64_infcall_ops object
using the brace-enclosed initializer list when the ia64_infcall_ops
fields are assigned default values.
Later compilers don't have a problem with that, so I suppose that the
code is correct, but still, change it to make gcc 4.8 happy. Don't
initialize the fields of ia64_infcall_ops directly, instead
default-initialize ia64_gdbarch_tdep::infcall_ops.
Change-Id: I35e3a61abd7b7bbcafe6cb207078c738c5266d76
---
gdb/ia64-tdep.h | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/gdb/ia64-tdep.h b/gdb/ia64-tdep.h
index 82319d50894..d831484ee57 100644
--- a/gdb/ia64-tdep.h
+++ b/gdb/ia64-tdep.h
@@ -216,18 +216,17 @@ struct ia64_infcall_ops
Should do nothing if this operation is not permitted by the OS. */
void (*allocate_new_rse_frame) (struct regcache *regcache, ULONGEST bsp,
- int sof) = nullptr;
+ int sof);
/* Store the argument stored in BUF into the appropriate location
given the BSP and the SLOTNUM. */
void (*store_argument_in_slot) (struct regcache *regcache, CORE_ADDR bsp,
- int slotnum, gdb_byte *buf) = nullptr;
+ int slotnum, gdb_byte *buf);
/* For targets where we cannot call the function directly, store
the address of the function we want to call at the location
expected by the calling sequence. */
- void (*set_function_addr) (struct regcache *regcache, CORE_ADDR func_addr)
- = nullptr;
+ void (*set_function_addr) (struct regcache *regcache, CORE_ADDR func_addr);
};
struct ia64_gdbarch_tdep : gdbarch_tdep
@@ -255,7 +254,7 @@ struct ia64_gdbarch_tdep : gdbarch_tdep
/* ISA-specific data types. */
struct type *ia64_ext_type = nullptr;
- struct ia64_infcall_ops infcall_ops;
+ struct ia64_infcall_ops infcall_ops {};
};
extern void ia64_write_pc (struct regcache *, CORE_ADDR);
--
2.33.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] gdb: fix array-view-selftests.c build with g++ 4.8
2021-11-18 20:50 [PATCH 1/2] gdb: fix ia64-tdep.c build with g++ 4.8 Simon Marchi
@ 2021-11-18 20:50 ` Simon Marchi
2021-11-18 21:11 ` Lancelot SIX
0 siblings, 1 reply; 4+ messages in thread
From: Simon Marchi @ 2021-11-18 20:50 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
When building with g++ 4.8, I get:
CXX unittests/array-view-selftests.o
/home/smarchi/src/binutils-gdb/gdb/unittests/array-view-selftests.c:123:42: error: expected 'class' before 'Container'
template<template<typename ...> typename Container>
^
I am no C++ template expert, but it looks like if I change "typename" for
"class", as the compiler kind of suggests, the code compiles.
Change-Id: I9c3edd29fb2b190069f0ce0dbf3bc3604d175f48
---
gdb/unittests/array-view-selftests.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/unittests/array-view-selftests.c b/gdb/unittests/array-view-selftests.c
index fe211a647b5..9df48db3912 100644
--- a/gdb/unittests/array-view-selftests.c
+++ b/gdb/unittests/array-view-selftests.c
@@ -120,7 +120,7 @@ check ()
/* Check that there's no container->view conversion for containers of derived
types or subclasses. */
-template<template<typename ...> typename Container>
+template<template<typename ...> class Container>
static constexpr bool
check_ctor_from_container ()
{
--
2.33.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] gdb: fix array-view-selftests.c build with g++ 4.8
2021-11-18 20:50 ` [PATCH 2/2] gdb: fix array-view-selftests.c " Simon Marchi
@ 2021-11-18 21:11 ` Lancelot SIX
2021-11-18 21:36 ` Simon Marchi
0 siblings, 1 reply; 4+ messages in thread
From: Lancelot SIX @ 2021-11-18 21:11 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches
On Thu, Nov 18, 2021 at 03:50:53PM -0500, Simon Marchi via Gdb-patches wrote:
> When building with g++ 4.8, I get:
>
> CXX unittests/array-view-selftests.o
> /home/smarchi/src/binutils-gdb/gdb/unittests/array-view-selftests.c:123:42: error: expected 'class' before 'Container'
> template<template<typename ...> typename Container>
> ^
>
> I am no C++ template expert, but it looks like if I change "typename" for
> "class", as the compiler kind of suggests, the code compiles.
Indeed. Apparently 'typename' can be used instead of 'class' in a
template template parameter only starting c++17[1].
Thanks for taking care of this.
Lancelot.
[1] https://en.cppreference.com/w/cpp/language/template_parameters#Template_template_parameter
q>
> Change-Id: I9c3edd29fb2b190069f0ce0dbf3bc3604d175f48
> ---
> gdb/unittests/array-view-selftests.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdb/unittests/array-view-selftests.c b/gdb/unittests/array-view-selftests.c
> index fe211a647b5..9df48db3912 100644
> --- a/gdb/unittests/array-view-selftests.c
> +++ b/gdb/unittests/array-view-selftests.c
> @@ -120,7 +120,7 @@ check ()
> /* Check that there's no container->view conversion for containers of derived
> types or subclasses. */
>
> -template<template<typename ...> typename Container>
> +template<template<typename ...> class Container>
> static constexpr bool
> check_ctor_from_container ()
> {
> --
> 2.33.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] gdb: fix array-view-selftests.c build with g++ 4.8
2021-11-18 21:11 ` Lancelot SIX
@ 2021-11-18 21:36 ` Simon Marchi
0 siblings, 0 replies; 4+ messages in thread
From: Simon Marchi @ 2021-11-18 21:36 UTC (permalink / raw)
To: Lancelot SIX, Simon Marchi; +Cc: gdb-patches
On 2021-11-18 4:11 p.m., Lancelot SIX via Gdb-patches wrote:
> On Thu, Nov 18, 2021 at 03:50:53PM -0500, Simon Marchi via Gdb-patches wrote:
>> When building with g++ 4.8, I get:
>>
>> CXX unittests/array-view-selftests.o
>> /home/smarchi/src/binutils-gdb/gdb/unittests/array-view-selftests.c:123:42: error: expected 'class' before 'Container'
>> template<template<typename ...> typename Container>
>> ^
>>
>> I am no C++ template expert, but it looks like if I change "typename" for
>> "class", as the compiler kind of suggests, the code compiles.
>
> Indeed. Apparently 'typename' can be used instead of 'class' in a
> template template parameter only starting c++17[1].
>
> Thanks for taking care of this.
>
> Lancelot.
>
> [1] https://en.cppreference.com/w/cpp/language/template_parameters#Template_template_parameter
Ok, thanks for the info. Since you acked this patch and patch 1/2
fixes a regression I introduced, I pushed the two patches.
Simon
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-18 21:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 20:50 [PATCH 1/2] gdb: fix ia64-tdep.c build with g++ 4.8 Simon Marchi
2021-11-18 20:50 ` [PATCH 2/2] gdb: fix array-view-selftests.c " Simon Marchi
2021-11-18 21:11 ` Lancelot SIX
2021-11-18 21:36 ` 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).