Return 'int' rather than 'unsigned short' in avrdis_opcode
authorYao Qi <yao.qi@linaro.org>
Thu, 29 Dec 2016 15:47:40 +0000 (15:47 +0000)
committerYao Qi <yao.qi@linaro.org>
Thu, 29 Dec 2016 15:47:40 +0000 (15:47 +0000)
commit0a7e10188e3c08403fb00b728644d7a95092c732
treef812ae364685b510ad42f5bfbbd6720cf083537f
parente81830c5c61a8665c098189d069cc68b0df113d3
Return 'int' rather than 'unsigned short' in avrdis_opcode

avrdis_opcode return type is unsigned short, but -1 at the end of
this function is returned.  Additionally, print_insn_avr doesn't
handle when -1 (in case of memory error) is returned from
avrdis_opcode.

This patch changes avrdis_opcode returning int indicating the error,
and adds a new argument for instruction we got on success.  The
opcode is 16-bit, so I change local variables type to uint16_t,
and include "bfd_stdint.h" as a result.  On memory error,
print_insn_avr returns -1, which is a common convention among most
of print_insn_$ARCH functions.

opcodes:

2016-12-29  Yao Qi  <yao.qi@linaro.org>

* avr-dis.c: Include "bfd_stdint.h"
(avrdis_opcode): Change return type to int, add argument
insn.  Set *INSN on success.
(print_insn_avr): Check return value of avrdis_opcode, and
return -1 on error.
opcodes/ChangeLog
opcodes/avr-dis.c
This page took 0.023973 seconds and 4 git commands to generate.