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

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

Commit Message

Simon Marchi Oct. 11, 2015, 4:37 a.m. UTC
  This patch is taken directly from Pedro's branch.

/home/pedro/gdb/mygit/src/gdb/mips-tdep.c: In function ‘ULONGEST mips_fetch_instruction(gdbarch*, mips_isa, CORE_ADDR, int*)’:
/home/pedro/gdb/mygit/src/gdb/mips-tdep.c:1460:28: error: invalid conversion from ‘int’ to ‘target_xfer_status’ [-fpermissive]
  memory_error (status, addr);

gdb/ChangeLog:

	* mips-tdep.c (mips_fetch_instruction): Add cast.
---
 gdb/mips-tdep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Pedro Alves Oct. 12, 2015, 10:54 a.m. UTC | #1
On 10/11/2015 05:37 AM, Simon Marchi wrote:
> This patch is taken directly from Pedro's branch.
> 
> /home/pedro/gdb/mygit/src/gdb/mips-tdep.c: In function ‘ULONGEST mips_fetch_instruction(gdbarch*, mips_isa, CORE_ADDR, int*)’:
> /home/pedro/gdb/mygit/src/gdb/mips-tdep.c:1460:28: error: invalid conversion from ‘int’ to ‘target_xfer_status’ [-fpermissive]
>   memory_error (status, addr);
> 
> gdb/ChangeLog:
> 
> 	* mips-tdep.c (mips_fetch_instruction): Add cast.
> ---
>  gdb/mips-tdep.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
> index 2275138..73b9221 100644

> --- a/gdb/mips-tdep.c
> +++ b/gdb/mips-tdep.c
> @@ -1456,7 +1456,7 @@ mips_fetch_instruction (struct gdbarch *gdbarch,
>    if (status)
>      {
>        if (statusp == NULL)
> -	memory_error (status, addr);
> +	memory_error ((enum target_xfer_status) status, addr);
>        return 0;
>      }

Please don't.  As discussed a while ago in IRC, I think we should
stop making target_read_memory & friends return a target_xfer_status.

I have a different patch in the branch to do that:

 https://github.com/palves/gdb/commit/22e5f84529cbe06a7b5c7fbbf662640b84e5cfb9

Thanks,
Pedro Alves
  
Simon Marchi Oct. 12, 2015, 4:28 p.m. UTC | #2
On 12/10/15 06:54 AM, Pedro Alves wrote:
> Please don't.  As discussed a while ago in IRC, I think we should
> stop making target_read_memory & friends return a target_xfer_status.
> 
> I have a different patch in the branch to do that:
> 
>  https://github.com/palves/gdb/commit/22e5f84529cbe06a7b5c7fbbf662640b84e5cfb9

Ok.  I remember that discussion, I didn't know that you followed up on
it.  Great!
  

Patch

diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 2275138..73b9221 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -1456,7 +1456,7 @@  mips_fetch_instruction (struct gdbarch *gdbarch,
   if (status)
     {
       if (statusp == NULL)
-	memory_error (status, addr);
+	memory_error ((enum target_xfer_status) status, addr);
       return 0;
     }
   return extract_unsigned_integer (buf, instlen, byte_order);