This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH] Return 'int' rather than 'unsigned short' in avrdis_opcode
- From: Alan Modra <amodra at gmail dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Sat, 24 Dec 2016 00:32:19 +1030
- Subject: Re: [PATCH] Return 'int' rather than 'unsigned short' in avrdis_opcode
- Authentication-results: sourceware.org; auth=none
- References: <email@example.com> <CAH=s-PMC3TtR1R5pdwiedhhPnJZML2NB7mtjHUFCSHhBg5ahVQ@mail.gmail.com>
On Mon, Dec 19, 2016 at 03:51:10PM +0000, Yao Qi wrote:
> On Mon, Dec 12, 2016 at 9:50 AM, Yao Qi <firstname.lastname@example.org> wrote:
> > 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.
> > Regression tested with all targets enabled. Is it OK?
> > opcodes:
> > 2016-12-12 Yao Qi <email@example.com>
> > * 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.
Australia Development Lab, IBM