Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb: fix command_classes name clash
@ 2025-11-05 22:59 simon.marchi
  2025-11-06  9:23 ` Tom de Vries
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: simon.marchi @ 2025-11-05 22:59 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

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
---
 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

end of thread, other threads:[~2025-11-06 17:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2025-11-06 17:20   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox