Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: simon.marchi@polymtl.ca, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: fix command_classes name clash
Date: Thu, 6 Nov 2025 10:23:59 +0100	[thread overview]
Message-ID: <8c0929d3-596a-483e-a247-b40409b0f9ab@suse.de> (raw)
In-Reply-To: <20251105225914.1492360-1-simon.marchi@polymtl.ca>

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


  reply	other threads:[~2025-11-06 15:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-05 22:59 simon.marchi
2025-11-06  9:23 ` Tom de Vries [this message]
2025-11-06 11:06 ` Andrew Burgess
2025-11-06 11:34 ` Guinevere Larsen
2025-11-06 17:15 ` Tom Tromey
2025-11-06 17:20   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c0929d3-596a-483e-a247-b40409b0f9ab@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox