This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Don't use bfd_get_* macro to set bfd fields
- From: Tom Tromey <tom at tromey dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 18 Sep 2019 09:19:40 -0600
- Subject: Re: Don't use bfd_get_* macro to set bfd fields
- References: <20190918125506.GF3685@bubble.grove.modra.org>
>>>>> "Alan" == Alan Modra <amodra@gmail.com> writes:
Alan> I've always thought it odd style to use a bfd_get macro on the left
Alan> hand side of an assignment. I didn't think it worth bothering to
Alan> make a bfd_set variant for these as their use would be local to bfd.
One trick we use in gdb is to prevent these assignments by making the
macro expand to an rvalue. An example from gdb:
#define MSYMBOL_SIZE(msymbol) ((msymbol)->size + 0)
Tom