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

Pedro Alves
2015-10-12T10:54:37Z

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