This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch 1/2] Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
- From: Pedro Alves <palves at redhat dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>, gdb-patches at sourceware dot org
- Date: Mon, 30 May 2016 11:44:46 +0100
- Subject: Re: [patch 1/2] Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
- Authentication-results: sourceware.org; auth=none
- References: <20160529141035 dot GA13685 at host1 dot jankratochvil dot net>
On 05/29/2016 03:10 PM, Jan Kratochvil wrote:
>
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -1606,9 +1606,24 @@ static void read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu);
> static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *,
> struct dwarf2_cu *, struct partial_symtab *);
>
> -static int dwarf2_get_pc_bounds (struct die_info *,
> - CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *,
> - struct partial_symtab *);
> +/* How dwarf2_get_pc_bounds constructed its *LOWPC and *HIGHPC return
> + values. */
> +enum pc_bounds_kind
> +{
> + /* No valid combination of DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges
> + was found. */
> + pc_bounds_not_present,
> +
> + /* Discontiguous range was found - that is DW_AT_ranges was found. */
> + pc_bounds_ranges,
> +
> + /* Contiguous range was found - DW_AT_low_pc and DW_AT_high_pc were found. */
> + pc_bounds_high_low,
I think it's much more common in GDB to uppercase enum values.
> +};
Add empty line here.
> +static enum pc_bounds_kind dwarf2_get_pc_bounds (struct die_info *,
> + CORE_ADDR *, CORE_ADDR *,
> + struct dwarf2_cu *,
> + struct partial_symtab *);
>
> - int has_pc_info;
> + enum pc_bounds_kind has_pc_info;
Shouldn't we rename the variable name too?
Otherwise LGTM.
Thanks,
Pedro Alves