Re: [PATCH] gdb: Have allocate_target_description return a unique_ptr

Pedro Alves
2020-10-07T11:41:45Z

On 10/5/20 8:47 PM, Andrew Burgess wrote:
> --- a/gdb/features/rs6000/powerpc-601.c
> +++ b/gdb/features/rs6000/powerpc-601.c
> @@ -9,7 +9,7 @@ struct target_desc *tdesc_powerpc_601;
> static void
> initialize_tdesc_powerpc_601 (void)
> {
> - struct target_desc *result = allocate_target_description ();
> + struct target_desc *result = allocate_target_description ().release ();
> struct tdesc_feature *feature;
>

Curious that you didn't tweak target-descriptions.c to output the more
pedantically correct:

target_desc_up result = allocate_target_description ();

...

feature = tdesc_create_feature (result.get (), "org.gnu.gdb.power.core");

...

tdesc_powerpc_601 = result.release ();

Anyhow, I like this change too, with or without the change above.

Pedro Alves