public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Hans-Peter Nilsson <hans-peter.nilsson@axis.com>,
	       Siddhesh Poyarekar <siddhesh@redhat.com>
Cc: binutils@sourceware.org, gdb-patches@sourceware.org
Subject: Re: [PATCH] bfd: Use size_t for length argument totarget_read_memory function passed into bfd_elf_bfd_from_remote_memory
Date: Fri, 01 Jun 2012 20:31:00 -0000	[thread overview]
Message-ID: <20120601203123.GA14319@host2.jankratochvil.net> (raw)
In-Reply-To: <20120602012410.43f5fdf6@spoyarek> <201206011824.q51IOEA8029007@ignucius.se.axis.com>

On Fri, 01 Jun 2012 20:24:14 +0200, Hans-Peter Nilsson wrote:
> There's always bfd_size_type, though I haven't checked if it
> fits your needs.

bfd_size_type seems to be always >= size_t so it should work.


> For reference, the m32r-elf fail:

I can confirm it with
	./configure --target=m32r-elf; make


On Fri, 01 Jun 2012 21:54:10 +0200, Siddhesh Poyarekar wrote:
> On Fri, 1 Jun 2012 20:24:14 +0200, Hans-Peter wrote:
> > There's always bfd_size_type, though I haven't checked if it
> > fits your needs.
> 
> Should be OK as long as it always matches the size_t definition in the
> stddef.h that gcc ships.

It is larger in some cases than size_t; but GDB can adapt, it is still better
than it was smaller before.


> They're both typically unsigned long, but if
> that is so, then bfd_size_type should have been typedef'd to size_t
> anyway.

Unfortunately bfd_size_type is not always type-compatible with size_t so
passing pointers to prototyped functions would not work.


> > Should bfd.h include sysdep.h or what is missing?

sysdep.h inclusion has caused problems which were avoided by
	Re: recent change broke gdb build
	http://sourceware.org/ml/binutils/2012-05/msg00224.html
but they can be hit in other cases like here, so I do not think bfd.h can
include sysdep.h.


> An stddef.h include in bfd.h should fix this.

stddef.h may not exist on the host system, it should include sysdep.h instead.


> That or I can fix my patch to use bfd_size_type provided its size is always
> equal to size_t, so that the include is not needed. Which way would be
> preferable?

I think the bfd/ part should use bfd_size_type and the gdb/ part should
continue to use size_t where possible, only in some few cases it needs to be
prototype-compatible with bfd/ it would use bfd_size_type.

Going to post a patch today as keeping HEAD broken is not good.


Thanks,
Jan

  parent reply	other threads:[~2012-06-01 20:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-28  9:05 Siddhesh Poyarekar
2012-05-28 11:03 ` Alan Modra
2012-05-28 11:11   ` Siddhesh Poyarekar
2012-05-28 21:29   ` Jan Kratochvil
2012-06-01 18:06   ` [commit bfd+gdb] " Jan Kratochvil
2012-06-01 18:24 ` Hans-Peter Nilsson
2012-06-01 19:54   ` Siddhesh Poyarekar
2012-06-01 20:31   ` Jan Kratochvil [this message]
2012-06-01 21:05     ` [patch#2] " Jan Kratochvil
2012-06-01 21:21       ` Hans-Peter Nilsson
2012-06-04  5:10       ` Hans-Peter Nilsson
2012-06-04  5:25         ` Jan Kratochvil
2012-06-04  6:23           ` Hans-Peter Nilsson
2012-06-04 12:11             ` Alan Modra
2012-06-04 14:37               ` [commit] " Jan Kratochvil
  -- strict thread matches above, loose matches on Subject: below --
2012-05-28  9:04 [PATCH] " Siddhesh Poyarekar

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=20120601203123.GA14319@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    --cc=hans-peter.nilsson@axis.com \
    --cc=siddhesh@redhat.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).