Allow C99/C11 in bfd?

Alan Modra
Tue Jan 28 01:29:00 GMT 2020

On Thu, Jan 23, 2020 at 11:37:27AM +0100, Christian Biesinger via binutils wrote:
> I noticed that bfd is currently using C89. I was wondering if there
> are any thoughts on allowing C99/C11 in there? It would be nice to be
> able to declare variables at the time of first use, among other useful
> features.

It wasn't so long ago that we were using K&R.  :-)

One of the reasons people used to give for being conservative is that
binutils is right at the bottom of the toolchain, and when
bootstrapping a new native GNU toolchain target you might not have
much in the way of native compiler support.  If there isn't an
intention of porting gcc for the target (or such support is delayed)
then cross-compiling might not be an option.  This all presumes a
native development system running some sort of OS, but those days are
past.  With the ubiquity of PCs, nowadays you'll invariably have a
cross-toolchain for a new cpu.  So there isn't any real reason to
stick with c89 IMO.

> (I'm not even going to ask about C++, although I think that would be nice)

I think any meaningful use of C++ would require a rewrite of BFD.

Just satisfying -Wc++-compat is a waste of time and results in a lot
of useless casts on bfd_alloc and similar that clutter the source.

Alan Modra
Australia Development Lab, IBM

More information about the Gdb mailing list