binutils-gdb/gdb/python
Tom de Vries d3d4840e80 [gdb/build] Fix build with gcc 9
Since commit a691853148 ("gdb/python: introduce gdbpy_registry"), when
building gdb with gcc 9, I run into:
...
In file included from gdb/varobj.c:38:0:
gdb/python/python-internal.h:1211:47: error: expected ‘;’ before ‘<’ token
   using StorageKey = typename registry<O>::key<Storage>;
                                               ^
...
due to this code:
...
template <typename Storage>
class gdbpy_registry
{
  ...

  template<typename O>
  using StorageKey = typename registry<O>::key<Storage>;

  template<typename O>
  Storage *get_storage (O *owner, const StorageKey<O> &key) const
  { ... }

  ...
}
...

As an experiment, I tried out eliminating the type alias:
...
  template<typename O>
  Storage *get_storage (O *owner,
                        const typename registry<O>::key<Storage> &key) const
  { ... }
...
and got instead:
...
In file included from gdb/varobj.c:38:0:
gdb/python/python-internal.h:1211:63: error: non-template ‘key’ used as template
  Storage *get_storage (O *owner,
                        const typename registry<O>::key<Storage> &key) const
                                                     ^~~
gdb/python/python-internal.h:1211:63: note: use ‘registry<O>::template key’ \
  to indicate that it is a template
...

Following that suggestion, I tried:
...
  template<typename O>
  Storage *
  get_storage (O *owner,
               const typename registry<O>::template key<Storage> &key) const
  { ... }
...
which fixed the problem.

Likewise, adding the template keyword in the type alias fixes the original
problem, so fix it like that.

Tested on x86_64-linux.
2025-03-20 11:16:59 +01:00
..
lib/gdb [gdb/python] Fix typos in lib 2025-03-06 23:21:54 +01:00
py-all-events.def Add gdb.events.tui_enabled 2024-11-01 11:06:47 -06:00
py-arch.c gdb/python: add void_type () method to gdb.Architecture object 2025-02-04 13:56:49 +00:00
py-auto-load.c [gdb/contrib] Add two rules in common-misspellings.txt 2024-11-23 12:20:34 +01:00
py-block.c gdb/python: add subblocks property to gdb.Block 2025-02-04 13:56:49 +00:00
py-bpevent.c
py-breakpoint.c Bploc should try to return full path 2025-03-03 18:53:12 +01:00
py-cmd.c [gdb/python] Eliminate GDB_PY_SET_HANDLE_EXCEPTION 2024-09-24 13:06:32 +02:00
py-color.c Add an option with a color type. 2025-01-12 13:30:43 -07:00
py-color.h Fix check-include-guards.py 2025-03-10 09:18:40 -06:00
py-connection.c Use gdb map in py-connection.c 2025-03-11 08:40:06 -06:00
py-continueevent.c
py-dap.c
py-disasm.c gdb/python: remove unused argument from builtin_disassemble 2025-03-15 17:12:12 +00:00
py-event-types.def Add gdb.events.tui_enabled 2024-11-01 11:06:47 -06:00
py-event.c Automatically add types to Python modules 2024-09-23 13:44:59 -06:00
py-event.h Run check-include-guards.py 2024-12-18 10:00:44 -07:00
py-events.h Run check-include-guards.py 2024-12-18 10:00:44 -07:00
py-evtregistry.c Automatically add types to Python modules 2024-09-23 13:44:59 -06:00
py-evts.c
py-exitedevent.c
py-finishbreakpoint.c [gdb/python] Eliminate GDB_PY_SET_HANDLE_EXCEPTION 2024-09-24 13:06:32 +02:00
py-frame.c [gdb/python] Eliminate GDB_PY_HANDLE_EXCEPTION 2024-09-24 13:06:32 +02:00
py-framefilter.c [gdb/python] Fix typos 2025-03-06 23:21:54 +01:00
py-function.c Call gdbpy_fix_doc_string_indentation for function help 2024-11-11 07:44:27 -07:00
py-gdb-readline.c [gdb/python] Eliminate GDB_PY_HANDLE_EXCEPTION 2024-09-24 13:06:32 +02:00
py-inferior.c gdb: split up construct_inferior_arguments 2025-03-18 13:03:07 +00:00
py-infevents.c
py-infthread.c [gdb/python] Eliminate GDB_PY_HANDLE_EXCEPTION 2024-09-24 13:06:32 +02:00
py-instruction.c Automatically add types to Python modules 2024-09-23 13:44:59 -06:00
py-instruction.h Run check-include-guards.py 2024-12-18 10:00:44 -07:00
py-lazy-string.c [gdb/python] Fix typos 2025-03-06 23:21:54 +01:00
py-linetable.c [gdb/python] Eliminate GDB_PY_HANDLE_EXCEPTION 2024-09-24 13:06:32 +02:00
py-membuf.c Automatically add types to Python modules 2024-09-23 13:44:59 -06:00
py-mi.c Require a command argument in gdb.execute_mi 2024-10-18 11:50:27 -06:00
py-micmd.c gdb/python: missing PyObject_IsTrue error check in micmdpy_set_installed 2024-11-14 19:34:44 +00:00
py-newobjfileevent.c
py-objfile.c [gdb/python] Eliminate GDB_PY_HANDLE_EXCEPTION 2024-09-24 13:06:32 +02:00
py-param.c Add an option with a color type. 2025-01-12 13:30:43 -07:00
py-prettyprint.c Automatically add types to Python modules 2024-09-23 13:44:59 -06:00
py-progspace.c [gdb/python] Fix typos 2025-03-06 23:21:54 +01:00
py-record-btrace.c btrace: Add support for interrupt events. 2024-09-24 14:22:28 +02:00
py-record-btrace.h Run check-include-guards.py 2024-12-18 10:00:44 -07:00
py-record-full.c
py-record-full.h Run check-include-guards.py 2024-12-18 10:00:44 -07:00
py-record.c [gdb/python] Eliminate GDB_PY_HANDLE_EXCEPTION 2024-09-24 13:06:32 +02:00
py-record.h Run check-include-guards.py 2024-12-18 10:00:44 -07:00
py-ref.h Run check-include-guards.py 2024-12-18 10:00:44 -07:00
py-registers.c Use gdb unordered set and map in Python layer 2025-03-18 05:32:04 -06:00
py-signalevent.c
py-stopevent.c [gdb/python] Eliminate GDB_PY_HANDLE_EXCEPTION 2024-09-24 13:06:32 +02:00
py-stopevent.h Run check-include-guards.py 2024-12-18 10:00:44 -07:00
py-symbol.c gdb/python: convert gdb.Symbol to use gdbpy_registry 2025-03-19 21:12:53 +00:00
py-symtab.c gdb/python: convert gdb.Symtab_and_line to use gdbpy_registry 2025-03-19 21:12:53 +00:00
py-threadevent.c
py-tui.c Add gdb.events.tui_enabled 2024-11-01 11:06:47 -06:00
py-type.c gdb/python: convert gdb.Type to use gdbpy_registry 2025-03-19 21:12:53 +00:00
py-uiout.h Add line-number styling 2024-09-30 13:23:35 -06:00
py-unwind.c gdb: Migrate frame unwinders to use C++ classes 2025-01-17 11:49:16 -03:00
py-utils.c [gdb/python] Make sure python sys.exit makes gdb exit 2024-09-25 19:29:57 +02:00
py-value.c gdb/python: do not hold on gdb.Type object from gdb.Value 2025-03-19 21:12:53 +00:00
py-varobj.c
py-xmethods.c
python-config.py
python-internal.h [gdb/build] Fix build with gcc 9 2025-03-20 11:16:59 +01:00
python.c gdb/python: new styling argument to gdb.execute 2025-03-19 14:31:53 +00:00
python.h Run check-include-guards.py 2024-12-18 10:00:44 -07:00