[cfe-dev] Setting default dialect to C++11

Nico Weber via cfe-dev cfe-dev at lists.llvm.org
Fri Mar 3 10:50:50 PST 2017


On Fri, Mar 3, 2017 at 1:15 PM, Richard Smith via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> On 3 March 2017 at 08:06, Aaron Ballman <aaron at aaronballman.com> wrote:
>
>> On Fri, Mar 3, 2017 at 7:57 AM, Reid Kleckner via cfe-dev
>> <cfe-dev at lists.llvm.org> wrote:
>> > On Fri, Mar 3, 2017 at 9:20 AM, Mehdi Amini via cfe-dev
>> > <cfe-dev at lists.llvm.org> wrote:
>> >>
>> >> On Mar 2, 2017, at 10:57 PM, Robinson, Paul <paul.robinson at sony.com>
>> >> wrote:
>> >>
>> >> Obviously in some cases target-specific defaults make a lot of sense --
>> >> for instance if we know that a target or its ABI or toolchain simply
>> doesn't
>> >> support some feature, or needs special support for something -- but in
>> the
>> >> absence of a strong reason, we should generally aim for all targets to
>> >> behave roughly the same.
>> >>
>> >> And in our case, the PS4 target simply doesn't support dialects other
>> than
>> >> C++11, therefore the target-specific default makes sense.
>> >>
>> >>
>> >> I gave an alternative view that shows that “it makes sense” is not
>> >> obvious.
>> >
>> >
>> > FWIW we already default to C++11 in an MSVC environment, regardless of
>> the
>> > driver used, because it's required to compile the MSVC STL headers. It's
>> > pretty close to Paul's use case of "the PS4 target simply doesn't
>> support
>> > dialects other than C++11". There's definitely prior art here.
>> >
>> > +1 to what James said, we should just raise the language standard
>> across the
>> > board.
>>
>> +1
>
>
> Would raising the language standard to C++14 cause problems for PS4 or
> MSVC? Is the constraint there "at least C++11" (because, say, the system
> headers are written in C++11) or "exactly C++11" (and if so, why?)?
>

I think clang-cl already defaults to C++14 (in MSVC2015 compat mode --
http://llvm-cs.pcc.me.uk/tools/clang/lib/Driver/Tools.cpp#4727). MSVC used
to not have a flag like -std and cl used to always support the newest C++,
with toggles for some language features that have compat implications. For
17, they did add a flag. We went over this on one of the former threads on
this topic (http://lists.llvm.org/pipermail/cfe-dev/2016-June/049733.html)
:-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170303/8e5ce2b7/attachment.html>


More information about the cfe-dev mailing list