public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: Tristan Gingold <gingold@adacore.com>
Cc: binutils Development <binutils@sourceware.org>
Subject: Re: [patch/gas]: simplify frag_grow
Date: Mon, 11 Jul 2011 12:05:00 -0000	[thread overview]
Message-ID: <20110711020551.GJ26365@bubble.grove.modra.org> (raw)
In-Reply-To: <BAE4624E-5698-4B1E-AE8B-A7078B9B95A0@adacore.com>

On Wed, Jul 06, 2011 at 09:00:29AM +0200, Tristan Gingold wrote:
> +      if (newc <= 0)
> +        as_fatal (_("can't extend frag to %u chars"), nchars);

Watch out for proliferation of messages.  There isn't any reason for a
difference between this error and the later one.  (In fact this
message isn't correct since we are extending the frag *by* nchars, not
to a total size of nchars.)

> +      /* Force to allocate at least NEWC bytes.  */
> +      oldc = obstack_chunk_size (&frchain_now->frch_obstack);
> +      obstack_chunk_size (&frchain_now->frch_obstack) = newc;
> +
> +      /* Do the real work: create a new frag.  */
> +      frag_new (0);
> +
> +      /* Restore the old chunk size.  */
> +      obstack_chunk_size (&frchain_now->frch_obstack) = oldc;

An alternative to fixing the error message would be to wrap the above
all in "if (newc > 0){}" and dispense with the first as_fatal call.
Your choice.  Either way is OK to commit.

> +      /* Make it obvious that we succeed.  */
> +      if (obstack_room (&frchain_now->frch_obstack) < nchars)
> +        as_fatal (_("can't extend frag %u chars"), nchars);
>      }
> -  if (obstack_room (&frchain_now->frch_obstack) < nchars)
> -    as_fatal (_("can't extend frag %u chars"), nchars);
>  }
>  
> 
>  /* Call this to close off a completed frag, and start up a new (empty)

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2011-07-11  2:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-05 17:49 Tristan Gingold
2011-07-06  4:45 ` Alan Modra
2011-07-06  7:25   ` Tristan Gingold
2011-07-11 12:05     ` Alan Modra [this message]
2011-07-25 14:49       ` Tristan Gingold
2011-07-26 20:14         ` Steve Ellcey
2011-07-26 21:14 ` Steve Ellcey
2011-07-27  6:56   ` Hans-Peter Nilsson
2011-07-27  7:39     ` Tristan Gingold
2011-07-27 10:06     ` Tristan Gingold
2011-07-27 16:08     ` [patch v2/gas]: " Tristan Gingold
2011-07-29  6:01       ` Alan Modra
2011-08-01  8:06         ` Tristan Gingold
2011-07-27 11:42   ` [patch/gas]: " Tristan Gingold

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=20110711020551.GJ26365@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=gingold@adacore.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).