* Re: [PATCH] gdb: fix command_classes name clash
2025-11-05 22:59 [PATCH] gdb: fix command_classes name clash simon.marchi
@ 2025-11-06 9:23 ` Tom de Vries
2025-11-06 11:06 ` Andrew Burgess
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Tom de Vries @ 2025-11-06 9:23 UTC (permalink / raw)
To: simon.marchi, gdb-patches
On 11/5/25 11:59 PM, simon.marchi@polymtl.ca wrote:
> From: Simon Marchi <simon.marchi@polymtl.ca>
>
> I currently see this build failure:
>
> CXX guile/scm-cmd.o
> /home/simark/src/binutils-gdb/gdb/guile/scm-cmd.c:551:54: error: ‘const scheme_integer_constant command_classes []’ redeclared as different kind of entity
> 551 | static const scheme_integer_constant command_classes[] =
> | ^
> In file included from /home/simark/src/binutils-gdb/gdb/defs.h:63,
> from <command-line>:
> /home/simark/src/binutils-gdb/gdb/command.h:71:42: note: previous declaration ‘using command_classes = class enum_flags<command_class>’
> 71 | DEF_ENUM_FLAGS_TYPE (enum command_class, command_classes);
> | ^~~~~~~~~~~~~~~
> /home/simark/src/binutils-gdb/gdb/../gdbsupport/enum-flags.h:58:9: note: in definition of macro ‘DEF_ENUM_FLAGS_TYPE’
> 58 | using flags_type = enum_flags<enum_type>; \
> | ^~~~~~~~~~
>
> This looks like an unfortunate name clash. Fix it by renaming the
> variable in scm-cmd.c.
Hi Simon,
I also ran into this problem, thanks for fixing this.
The fix looks trivial enough, and I managed to build gdb and run the
testsuite past gdb.guile without any fallout, so LGTM, please apply.
Approved-By: Tom de Vries <tdevries@suse.de>
Thanks,
- Tom
>
> Change-Id: I226b052c28eb8d09fd6840337845a387cd818085
> ---
> gdb/guile/scm-cmd.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
> index d2172d986187..bfd11917df96 100644
> --- a/gdb/guile/scm-cmd.c
> +++ b/gdb/guile/scm-cmd.c
> @@ -548,7 +548,7 @@ gdbscm_parse_command_name (const char *name,
> /* NOTREACHED */
> }
>
> -static const scheme_integer_constant command_classes[] =
> +static const scheme_integer_constant scm_command_classes[] =
> {
> /* Note: alias and user are special; pseudo appears to be unused,
> and there is no reason to expose tui, I think. */
> @@ -576,9 +576,9 @@ gdbscm_valid_command_class_p (int command_class)
> {
> int i;
>
> - for (i = 0; command_classes[i].name != NULL; ++i)
> + for (i = 0; scm_command_classes[i].name != NULL; ++i)
> {
> - if (command_classes[i].value == command_class)
> + if (scm_command_classes[i].value == command_class)
> return 1;
> }
>
> @@ -903,7 +903,7 @@ gdbscm_initialize_commands (void)
> = gdbscm_make_smob_type (command_smob_name, sizeof (command_smob));
> scm_set_smob_print (command_smob_tag, cmdscm_print_command_smob);
>
> - gdbscm_define_integer_constants (command_classes, 1);
> + gdbscm_define_integer_constants (scm_command_classes, 1);
> gdbscm_define_functions (command_functions, 1);
>
> for (i = 0; i < N_COMPLETERS; ++i)
>
> base-commit: 1518f2e087d31997711fc7f4472ab382c24fa903
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] gdb: fix command_classes name clash
2025-11-05 22:59 [PATCH] gdb: fix command_classes name clash simon.marchi
2025-11-06 9:23 ` Tom de Vries
@ 2025-11-06 11:06 ` Andrew Burgess
2025-11-06 11:34 ` Guinevere Larsen
2025-11-06 17:15 ` Tom Tromey
3 siblings, 0 replies; 6+ messages in thread
From: Andrew Burgess @ 2025-11-06 11:06 UTC (permalink / raw)
To: simon.marchi, gdb-patches; +Cc: Simon Marchi
simon.marchi@polymtl.ca writes:
> From: Simon Marchi <simon.marchi@polymtl.ca>
>
> I currently see this build failure:
>
> CXX guile/scm-cmd.o
> /home/simark/src/binutils-gdb/gdb/guile/scm-cmd.c:551:54: error: ‘const scheme_integer_constant command_classes []’ redeclared as different kind of entity
> 551 | static const scheme_integer_constant command_classes[] =
> | ^
> In file included from /home/simark/src/binutils-gdb/gdb/defs.h:63,
> from <command-line>:
> /home/simark/src/binutils-gdb/gdb/command.h:71:42: note: previous declaration ‘using command_classes = class enum_flags<command_class>’
> 71 | DEF_ENUM_FLAGS_TYPE (enum command_class, command_classes);
> | ^~~~~~~~~~~~~~~
> /home/simark/src/binutils-gdb/gdb/../gdbsupport/enum-flags.h:58:9: note: in definition of macro ‘DEF_ENUM_FLAGS_TYPE’
> 58 | using flags_type = enum_flags<enum_type>; \
> | ^~~~~~~~~~
>
> This looks like an unfortunate name clash. Fix it by renaming the
> variable in scm-cmd.c.
Approved-By: Andrew Burgess <aburgess@redhat.com>
Thanks,
Andrew
>
> Change-Id: I226b052c28eb8d09fd6840337845a387cd818085
> ---
> gdb/guile/scm-cmd.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
> index d2172d986187..bfd11917df96 100644
> --- a/gdb/guile/scm-cmd.c
> +++ b/gdb/guile/scm-cmd.c
> @@ -548,7 +548,7 @@ gdbscm_parse_command_name (const char *name,
> /* NOTREACHED */
> }
>
> -static const scheme_integer_constant command_classes[] =
> +static const scheme_integer_constant scm_command_classes[] =
> {
> /* Note: alias and user are special; pseudo appears to be unused,
> and there is no reason to expose tui, I think. */
> @@ -576,9 +576,9 @@ gdbscm_valid_command_class_p (int command_class)
> {
> int i;
>
> - for (i = 0; command_classes[i].name != NULL; ++i)
> + for (i = 0; scm_command_classes[i].name != NULL; ++i)
> {
> - if (command_classes[i].value == command_class)
> + if (scm_command_classes[i].value == command_class)
> return 1;
> }
>
> @@ -903,7 +903,7 @@ gdbscm_initialize_commands (void)
> = gdbscm_make_smob_type (command_smob_name, sizeof (command_smob));
> scm_set_smob_print (command_smob_tag, cmdscm_print_command_smob);
>
> - gdbscm_define_integer_constants (command_classes, 1);
> + gdbscm_define_integer_constants (scm_command_classes, 1);
> gdbscm_define_functions (command_functions, 1);
>
> for (i = 0; i < N_COMPLETERS; ++i)
>
> base-commit: 1518f2e087d31997711fc7f4472ab382c24fa903
> --
> 2.51.2
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] gdb: fix command_classes name clash
2025-11-05 22:59 [PATCH] gdb: fix command_classes name clash simon.marchi
2025-11-06 9:23 ` Tom de Vries
2025-11-06 11:06 ` Andrew Burgess
@ 2025-11-06 11:34 ` Guinevere Larsen
2025-11-06 17:15 ` Tom Tromey
3 siblings, 0 replies; 6+ messages in thread
From: Guinevere Larsen @ 2025-11-06 11:34 UTC (permalink / raw)
To: simon.marchi, gdb-patches
On 11/5/25 7:59 PM, simon.marchi@polymtl.ca wrote:
> From: Simon Marchi <simon.marchi@polymtl.ca>
>
> I currently see this build failure:
>
> CXX guile/scm-cmd.o
> /home/simark/src/binutils-gdb/gdb/guile/scm-cmd.c:551:54: error: ‘const scheme_integer_constant command_classes []’ redeclared as different kind of entity
> 551 | static const scheme_integer_constant command_classes[] =
> | ^
> In file included from /home/simark/src/binutils-gdb/gdb/defs.h:63,
> from <command-line>:
> /home/simark/src/binutils-gdb/gdb/command.h:71:42: note: previous declaration ‘using command_classes = class enum_flags<command_class>’
> 71 | DEF_ENUM_FLAGS_TYPE (enum command_class, command_classes);
> | ^~~~~~~~~~~~~~~
> /home/simark/src/binutils-gdb/gdb/../gdbsupport/enum-flags.h:58:9: note: in definition of macro ‘DEF_ENUM_FLAGS_TYPE’
> 58 | using flags_type = enum_flags<enum_type>; \
> | ^~~~~~~~~~
>
> This looks like an unfortunate name clash. Fix it by renaming the
> variable in scm-cmd.c.
>
> Change-Id: I226b052c28eb8d09fd6840337845a387cd818085
> ---
oops, sorry about that, I disable guile on my build and didn't notice
the name clash.
I encourage you to push this! Reviewed-By: Guinevere Larsen
<guinevere@redhat.com>
> gdb/guile/scm-cmd.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
> index d2172d986187..bfd11917df96 100644
> --- a/gdb/guile/scm-cmd.c
> +++ b/gdb/guile/scm-cmd.c
> @@ -548,7 +548,7 @@ gdbscm_parse_command_name (const char *name,
> /* NOTREACHED */
> }
>
> -static const scheme_integer_constant command_classes[] =
> +static const scheme_integer_constant scm_command_classes[] =
> {
> /* Note: alias and user are special; pseudo appears to be unused,
> and there is no reason to expose tui, I think. */
> @@ -576,9 +576,9 @@ gdbscm_valid_command_class_p (int command_class)
> {
> int i;
>
> - for (i = 0; command_classes[i].name != NULL; ++i)
> + for (i = 0; scm_command_classes[i].name != NULL; ++i)
> {
> - if (command_classes[i].value == command_class)
> + if (scm_command_classes[i].value == command_class)
> return 1;
> }
>
> @@ -903,7 +903,7 @@ gdbscm_initialize_commands (void)
> = gdbscm_make_smob_type (command_smob_name, sizeof (command_smob));
> scm_set_smob_print (command_smob_tag, cmdscm_print_command_smob);
>
> - gdbscm_define_integer_constants (command_classes, 1);
> + gdbscm_define_integer_constants (scm_command_classes, 1);
> gdbscm_define_functions (command_functions, 1);
>
> for (i = 0; i < N_COMPLETERS; ++i)
>
> base-commit: 1518f2e087d31997711fc7f4472ab382c24fa903
--
Cheers,
Guinevere Larsen
It/she
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] gdb: fix command_classes name clash
2025-11-05 22:59 [PATCH] gdb: fix command_classes name clash simon.marchi
` (2 preceding siblings ...)
2025-11-06 11:34 ` Guinevere Larsen
@ 2025-11-06 17:15 ` Tom Tromey
2025-11-06 17:20 ` Simon Marchi
3 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2025-11-06 17:15 UTC (permalink / raw)
To: simon.marchi; +Cc: gdb-patches
Simon> This looks like an unfortunate name clash. Fix it by renaming the
Simon> variable in scm-cmd.c.
I didn't check the list early enough, so I ended up checking in
essentially the same fix already.
I considered this obvious FWIW.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] gdb: fix command_classes name clash
2025-11-06 17:15 ` Tom Tromey
@ 2025-11-06 17:20 ` Simon Marchi
0 siblings, 0 replies; 6+ messages in thread
From: Simon Marchi @ 2025-11-06 17:20 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On 11/6/25 12:15 PM, Tom Tromey wrote:
> Simon> This looks like an unfortunate name clash. Fix it by renaming the
> Simon> variable in scm-cmd.c.
>
> I didn't check the list early enough, so I ended up checking in
> essentially the same fix already.
>
> I considered this obvious FWIW.
>
> Tom
I think you did the right thing, thanks.
Simon
^ permalink raw reply [flat|nested] 6+ messages in thread