<div dir="ltr">I'd say +1 to raising the default c++ version for everyone now.<div><br></div><div>And, in general, to have a policy of raising the default language version whenever a new version has been well-supported and available to opt into for a reasonable period of time.<div><br></div><div>People who want to stick to an old language version can set that version explicitly in their builds.</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 2, 2017 at 1:40 PM, Mehdi Amini via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div class="h5"><br><div><blockquote type="cite"><div>On Mar 2, 2017, at 10:37 AM, Mehdi Amini via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="m_-8374889053727027616Apple-interchange-newline"><div><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br class="m_-8374889053727027616Apple-interchange-newline">On Mar 2, 2017, at 7:35 AM, Robinson, Paul via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br><br><br><br><blockquote type="cite">-----Original Message-----<br>From: cfe-dev [<a href="mailto:cfe-dev-bounces@lists.llvm.org" target="_blank">mailto:cfe-dev-bounces@lists.<wbr>llvm.org</a>] On Behalf Of Joerg<br>Sonnenberger via cfe-dev<br>Sent: Thursday, March 02, 2017 4:02 AM<br>To: <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>Subject: Re: [cfe-dev] Setting default dialect to C++11<br><br>On Wed, Mar 01, 2017 at 05:07:00PM -0800, Mehdi Amini via cfe-dev wrote:<br><blockquote type="cite">Right, I don’t think it is a good idea for clang as a project to have<br>important default configuration flags that diverge between<br>platform/target, like the default language. This is reducing portability<br>and quite user hostile IMO.<br></blockquote></blockquote><br>I don't understand how it is "user hostile”<br></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">I expect `clang myprogram` to treat my program sanely (i.e. not change the language standard behind my back without me knowing). Requiring me to specify that I’m OK using C++22 seems fine.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">to have our toolchain default<br>to making "clang -c t.cpp" Do The Right Thing in the context of our SDK.<br></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">As you mentioned below, Xcode has default flags for clang that are always set. It does not mean that the clang supplied by Apple would change language default. I expect an SDK to help the user to setup the right flag. That different from changing the default inside the compiler.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">We provide the correct target triple; we point to the correct directory<br>for our headers; we point to the correct directory for our libraries; we<br>set the correct target and subtarget [there is only one]; we do a variety<br>of other defaulting, as a service and convenience to our users.<br><br><blockquote type="cite"><br>I somewhat disagree and that's why I didn't have a problem with the<br>change. As long as we silently miscompile C++03 code when enabling C++11<br>or later, I don't think it should be a general default. In a somewhat<br>more restricted environment like the Playstation toolchain, they are in<br>a much better position to judge wether those miscompiles will be<br>triggered by their userbase or not.<br><br>Joerg<br><br><blockquote type="cite">For example if a platform does not support exception, the driver can<br>error if -fno-exceptions isn’t supplied, requiring an opt-in from the user.<br></blockquote></blockquote><br>We *support* exceptions, it's just not our *default* (same as for Xcode).<br>Erroring out on "clang -c t.cpp" seems incredibly user-hostile, but that<br>is the burden you are proposing on all of our licensees.<br></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">I don’t see any burden here.<span class="m_-8374889053727027616Apple-converted-space"> </span></span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br>Now let's look at it from the other side:  What are the advantages of having<br>different defaults?  The primary advantage I see is increased test coverage.<br></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">I don’t buy this: setup your SDK environment to invoke clang with the right set of flags and setup bots to test more configuration.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Internally we run lots of our tests in a pile of different configurations<br>(different optimization levels, with/without -g, with/without LTO, etc)<br>and this has proven to be very helpful in finding bugs.<br><br>I don't have statistics off the top of my head but the C++11 default has<br>found things; see for example PR32066.  This tells me there is value to<br>avoiding a "configuration monoculture" and varying defaults is a good thing.<br></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">No it just means more testing coverage is good. Changing the default is not the right way to achieve this IMO.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"></div></blockquote><div><br></div></div></div></div>And as an example, since I just setup a bot for libc++ yesterday, it runs the tests with std=c++11, then with std=c++14, then with std=c++1z.<div><br></div><div><a href="http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_master_cmake/" target="_blank">http://lab.llvm.org:8080/<wbr>green/view/Libcxx/job/libcxx_<wbr>master_cmake/</a></div><div><br></div><div>I believe designing testing this way is providing better coverage overall that changing some defaults in the compiler based on  SDK provider will.</div><div><br></div><div><div>— </div><div>Mehdi</div><div><br></div></div></div><br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>