This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] cleanup: remove unused - ada
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Aleksandar Ristovski <aristovski at qnx dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 30 Jan 2013 19:13:42 -0800
- Subject: Re: [patch] cleanup: remove unused - ada
- References: <5109E02B.7090408@qnx.com>
[moving to gdb-patches]
Hi Aleksandar,
> This is removing unused variables and allows compiling with -Wunused.
>
> Thanks,
>
> Aleksandar Ristovski
> QNX Software Systems
>
>
> ChangeLog:
>
> Aleksandar Ristovski <aristovski@qnx.com>
>
> * ada-lang.c (assign_aggregate): Remove unused IS_ARRAY_AGGREGATE.
> * ada-valprint.c (ada_print_floating): Remove unused LEN.
Indeed, these variables look unused. The patch is approved, and since
each change is independent of the other, if you could commit those
separately, I'd appreciate it.
One minor thing with the ChangeLog: The capitalized variable name
means "the value of the variable [whose name is capitalized]".
I'd probably say: Remove unused variable "is_array_aggregate".
Thanks for catching this.
> Index: gdb/ada-lang.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/ada-lang.c,v
> retrieving revision 1.391
> diff -u -p -r1.391 ada-lang.c
> --- gdb/ada-lang.c 24 Jan 2013 18:04:33 -0000 1.391
> +++ gdb/ada-lang.c 30 Jan 2013 22:25:14 -0000
> @@ -9029,7 +9029,6 @@ assign_aggregate (struct value *containe
> int num_specs;
> LONGEST *indices;
> int max_indices, num_indices;
> - int is_array_aggregate;
> int i;
>
> *pos += 3;
> @@ -9054,13 +9053,11 @@ assign_aggregate (struct value *containe
> lhs_type = value_type (lhs);
> low_index = TYPE_ARRAY_LOWER_BOUND_VALUE (lhs_type);
> high_index = TYPE_ARRAY_UPPER_BOUND_VALUE (lhs_type);
> - is_array_aggregate = 1;
> }
> else if (TYPE_CODE (lhs_type) == TYPE_CODE_STRUCT)
> {
> low_index = 0;
> high_index = num_visible_fields (lhs_type) - 1;
> - is_array_aggregate = 0;
> }
> else
> error (_("Left-hand side must be array or record."));
> Index: gdb/ada-valprint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/ada-valprint.c,v
> retrieving revision 1.95
> diff -u -p -r1.95 ada-valprint.c
> --- gdb/ada-valprint.c 7 Jan 2013 16:40:36 -0000 1.95
> +++ gdb/ada-valprint.c 30 Jan 2013 22:25:14 -0000
> @@ -320,7 +320,6 @@ ada_print_floating (const gdb_byte *vala
> {
> char buffer[64];
> char *s, *result;
> - int len;
> struct ui_file *tmp_stream = mem_fileopen ();
> struct cleanup *cleanups = make_cleanup_ui_file_delete (tmp_stream);
>
> @@ -329,7 +328,6 @@ ada_print_floating (const gdb_byte *vala
> do_cleanups (cleanups);
>
> result = buffer;
> - len = strlen (result);
>
> /* Modify for Ada rules. */
>
--
Joel