public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Nick Clifton <nickc@redhat.com>
Cc: binutils@sourceware.org, Claudiu.Zissulescu@synopsys.com,
	Cupertino.Miranda@synopsys.com, noamca@mellanox.com
Subject: Re: [PATCHv2 1/3] opcodes/arc: Move instruction length logic to new function
Date: Wed, 13 Apr 2016 14:41:00 -0000	[thread overview]
Message-ID: <20160413144058.GB5531@embecosm.com> (raw)
In-Reply-To: <570E4A76.5020504@redhat.com>

* Nick Clifton <nickc@redhat.com> [2016-04-13 14:32:38 +0100]:

> Hi Andrew,
> 
> > opcodes/ChangeLog:
> > 
> > 	* arc-dis.c (arc_insn_length): New function.
> > 	(print_insn_arc): Use arc_insn_length.
> 
> Approved - please apply, but ...
> 
> > +static int
> > +arc_insn_length (bfd_byte msb, bfd_byte lsb ATTRIBUTE_UNUSED,
> > +                 struct disassemble_info *info)
> 
> Would this function ever return a negative value ?  I assume not, so
> it would make sense for its return type to be "unsigned int".

I'm not sure is the answer.  I agree that arc_insn_length will never
return a negative, however, the return value from arc_insn_length is
used to prime a variable that is then the return value for
print_insn_arc, which is also defined to return 'int', and is part of
the disassembler API, and does return a negative value if there's an
error.

It was this relationship that originally lead me to make
arc_insn_length return an 'int'.

Given that it will only ever return small positive integers there
should be no problem making it return an unsigned value then casting
to int in print_insn_arc - would this be preferred?

Thanks,
Andrew

  reply	other threads:[~2016-04-13 14:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12 11:00 [PATCHv2 0/3] ARC: Add another group of nps instructions Andrew Burgess
2016-04-07 11:05 ` [PATCH " Andrew Burgess
2016-04-07 11:05   ` [PATCH 1/3] opcodes/arc: Compute insn lengths in disassembler Andrew Burgess
2016-04-07 11:27     ` Claudiu Zissulescu
2016-04-12  9:27     ` Claudiu Zissulescu
2016-04-07 11:05   ` [PATCH 2/3] bfd/arc: Rename enum entries to avoid conflicts Andrew Burgess
2016-04-07 11:20     ` Claudiu Zissulescu
2016-04-07 11:05   ` [PATCH 3/3] arc/nps400 : New cmem instructions and associated relocation Andrew Burgess
2016-04-11 12:55     ` Cupertino Miranda
2016-04-12 11:00   ` [PATCHv2 " Andrew Burgess
2016-04-13 13:37     ` Nick Clifton
2016-04-12 11:00   ` [PATCHv2 2/3] bfd/arc: Rename enum entries to avoid conflicts Andrew Burgess
2016-04-13 13:34     ` Nick Clifton
2016-04-12 11:00   ` [PATCHv2 1/3] opcodes/arc: Move instruction length logic to new function Andrew Burgess
2016-04-12 12:27     ` Claudiu Zissulescu
2016-04-13 13:32     ` Nick Clifton
2016-04-13 14:41       ` Andrew Burgess [this message]
2016-04-13 15:30         ` Nick Clifton
2016-04-14 12:40           ` Andrew Burgess
2016-04-14 14:45             ` Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160413144058.GB5531@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=Claudiu.Zissulescu@synopsys.com \
    --cc=Cupertino.Miranda@synopsys.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    --cc=noamca@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).