[c++,3/5] mep: Add cast for int to enum conversion

Message ID 1444538238-7468-3-git-send-email-simon.marchi@polymtl.ca
State New, archived
Headers

Commit Message

Simon Marchi Oct. 11, 2015, 4:37 a.m. UTC
  Taken directly from Pedro's branch.

gdb/ChangeLog:

	* mep-tdep.c (current_me_module): Add cast.
	(mep_gdbarch_init): Likewise.
---
 gdb/mep-tdep.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Comments

Yao Qi Oct. 12, 2015, 10:34 a.m. UTC | #1
Simon Marchi <simon.marchi@polymtl.ca> writes:

Hi Simon,
Patch is OK, one nit below,

> @@ -2396,7 +2396,10 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
>        /* The way to get the me_module code depends on the object file
>           format.  At the moment, we only know how to handle ELF.  */
>        if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
> -        me_module = elf_elfheader (info.abfd)->e_flags & EF_MEP_INDEX_MASK;
> +	{
> +	  int flag = elf_elfheader (info.abfd)->e_flags & EF_MEP_INDEX_MASK;

A blank line is needed here.

> +	  me_module = (CONFIG_ATTR) flag;
> +	}
>        else
>          me_module = CONFIG_NONE;
>      }
  
Simon Marchi Oct. 12, 2015, 4:43 p.m. UTC | #2
On 12/10/15 06:34 AM, Yao Qi wrote:
> Simon Marchi <simon.marchi@polymtl.ca> writes:
> 
> Hi Simon,
> Patch is OK, one nit below,
> 
>> @@ -2396,7 +2396,10 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
>>        /* The way to get the me_module code depends on the object file
>>           format.  At the moment, we only know how to handle ELF.  */
>>        if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
>> -        me_module = elf_elfheader (info.abfd)->e_flags & EF_MEP_INDEX_MASK;
>> +	{
>> +	  int flag = elf_elfheader (info.abfd)->e_flags & EF_MEP_INDEX_MASK;
> 
> A blank line is needed here.
> 
>> +	  me_module = (CONFIG_ATTR) flag;
>> +	}
>>        else
>>          me_module = CONFIG_NONE;
>>      }
> 

Thanks, pushed with the newline.
  

Patch

diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index b6f242f..f7d33ca 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -848,7 +848,7 @@  current_me_module (void)
       ULONGEST regval;
       regcache_cooked_read_unsigned (get_current_regcache (),
 				     MEP_MODULE_REGNUM, &regval);
-      return regval;
+      return (CONFIG_ATTR) regval;
     }
   else
     return gdbarch_tdep (target_gdbarch ())->me_module;
@@ -2396,7 +2396,10 @@  mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       /* The way to get the me_module code depends on the object file
          format.  At the moment, we only know how to handle ELF.  */
       if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
-        me_module = elf_elfheader (info.abfd)->e_flags & EF_MEP_INDEX_MASK;
+	{
+	  int flag = elf_elfheader (info.abfd)->e_flags & EF_MEP_INDEX_MASK;
+	  me_module = (CONFIG_ATTR) flag;
+	}
       else
         me_module = CONFIG_NONE;
     }