[PATCH RFC] bootstrap: Update requirement to C++11.

Jason Merrill jason@redhat.com
Fri May 15 21:53:42 GMT 2020


On 5/15/20 2:21 PM, Richard Biener wrote:
> On May 15, 2020 7:30:38 PM GMT+02:00, Jason Merrill <jason@redhat.com> wrote:
>> On Fri, May 15, 2020 at 3:15 AM Richard Biener
>> <richard.guenther@gmail.com>
>> wrote:
>>
>>>> +# When bootstrapping with GCC, build stage 1 in C++11 mode to
>> ensure
>>> that a
>>>> +# C++11 compiler can still start the bootstrap.
>>>>   if test "$enable_bootstrap:$GXX" = "yes:yes"; then
>>>> +  CXX="$CXX -std=gnu++11"
>>>
>>> So I just spotted this - since we're requiring a ISO C++11 compiler shouldn't
>>> we build stage1 with -std=c++11 rather than gnu++11 (whatever the detailed
>>> differences are here)?  Also not sure what level of -pedantic we'd need to
>>> avoid GNU extensions even with -std=c++11.  Of course there are (I hope)
>>> a lot less GNU extensions for C++ than there were for C and hopefully
>>> no extra in gnu++11 compared to gnu++98 which we checked previously.

Building stage 1 with -std=c++11 -pedantic-errors works with 8.3.1, but 
fails pretty badly with 4.8.5,

>> When we first moved to C++ I tried using -std=c++98, but there were too
>> many places where we were assuming that if we're building with GCC, we can
>> use GNU C extensions.
>>
>> I'll see if that's still a problem for -std=c++11.

It doesn't seem to be, so I've made that change.

>>> There also does not seem to be a configure check which may present
>>> users with a more useful error message than later cryptic fail of build?
>>> I suppose we cannot simply check __cplusplus for this, can we?  Do
>>> other common host compilers need additional options to enable C++11?
>>
>> Good point, I'll add that.

This patch uses a test from the autoconf archive to add any needed 
flags.  Tested with GCC 4.8.5 and clang 3.4.2 (with the above stage 1 
-std=c++11 disabled).

>>> Should we try to second guess such flags via configury?  For example
>>> GCC 4.8 defaults to -std=gnu++98 and the above only seems to apply
>>> to the bootstrap case so GCC 4.8 cannot be used to build cross
>> compilers
>>> without adjusting CC and CXX?
>>
>> Older GCC is still GCC and will get the flag automatically.
> 
> But yes:yes suggests that when building a cross compiler this doesn't apply?

True, but the new test should cover that case.

OK for trunk?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cxx11-boot.diff
Type: text/x-patch
Size: 50545 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200515/e54c2a24/attachment-0001.bin>


More information about the Gcc-patches mailing list