[gdb/build] Support reference return type in make-target-delegates.py
authorTom de Vries <tdevries@suse.de>
Wed, 23 Aug 2023 17:28:37 +0000 (19:28 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 23 Aug 2023 17:28:37 +0000 (19:28 +0200)
commit010278690441ef32d3c1089fa4fdfaeaf8cc49b7
tree9f1696c4381f5caff45b824d4cea54ec8e397920
parentfa4f2d46f95a1c673b025fab7f292cb864a99020
[gdb/build] Support reference return type in make-target-delegates.py

When doing this in target.h:
...
-    virtual gdb::byte_vector thread_info_to_thread_handle (struct thread_info *)
+    virtual gdb::byte_vector &thread_info_to_thread_handle (struct thread_info *)
...
make-target-delegates.py drops the function.

By handling '&' in POINTER_PART we can prevent that the function is dropped,
but when recompiling target.o we get:
...
gdb/target-delegates.c: In member function ‘virtual gdb::byte_vector& \
  debug_target::thread_info_to_thread_handle(thread_info*)’:
gdb/target-delegates.c:1889:22: error: ‘result’ declared as reference but not \
  initialized
   gdb::byte_vector & result;
                      ^~~~~~
make: *** [Makefile:1923: target.o] Error 1
...

Fix this by making sure result is initialized.

Regenerate target-delegates.c using this new style.

Tested on x86_64-linux.

Approved-By: Pedro Alves <pedro@palves.net>
gdb/make-target-delegates.py
gdb/target-delegates.c