Re: [PATCH 0/1] Build GDB as a C++ program by default

Pedro Alves
2016-04-19T14:18:49Z

On 04/19/2016 02:34 PM, Simon Marchi wrote:
> On 16-04-18 01:27 PM, Pedro Alves wrote:
>> It's been a long ride, but GDB now builds cleanly as a C++ program on
>> most supported systems.
>>
>> There are a few host-specific files that may be missing the occasional
>> cast, but for all I know, most of the codebase has been converted and
>> builds cleanly, with no undefined behavior and no hacks.
>>
>> It's time to try building GDB with a C++ compiler by default, which is
>> what the the following trivial patch does.
>>
>> Following the discussion on the gdb@ list, this flips the default on
>> all hosts, unconditionally.

> Does that mean that all supported hosts have been tested to build in C++?

"all" is a bit too wide. There are simply too many to tell:

https://sourceware.org/gdb/wiki/Systems

I don't know whether VAX or m68k BSD build cleanly, for instance.
I don't know whether they build cleanly in C-mode, either -- I
wouldn't be surprised if several of the listed systems on that
table didn't build today.

It sort of goes back to what you'd call "supported host". If
nobody's actively caring about such hosts, then it's just
going to happen that changes elsewhere will accidentally break
them.

But at least we know that x86-64 NetBSD and FreeBSD build and run
in C++ mode, which I think is sufficient proxy for all BSDs, in
the sense that if something else is needed it'll probably be a
couple malloc casts here and there in the corresponding $arch-nat.c
files.

AFAIK, all GNU/Linux ports build cleanly.

(Except maybe Xtensa, which may need your small cast patch on
my github. Is that one still needed?).

MinGW (w64) builds and runs cleanly for me too.

I think the ones pending confirmation are Solaris and QNX.

If we do find some host does trip on some big problem, then we
can always flip it back to C by default.

Given that the request for testing with --enable-build-with-cxx
was sent five months ago, and nobody reported breakage (nor success)
on Solaris/QNX, I think we need to bite the bullet and move forward.

We won't know unless we try.

WDYT?

Thanks,
Pedro Alves