[cfe-dev] RFC: switch default C language mode from gnu99 to gnu11

Richard Smith richard at metafoo.co.uk
Thu Oct 16 19:07:31 PDT 2014


On Thu, Oct 16, 2014 at 5:17 PM, Robinson, Paul <
Paul_Robinson at playstation.sony.com> wrote:

>  On Thu, Oct 16, 2014 at 12:58 PM, Richard Smith <richard at metafoo.co.uk
> > wrote:
>
>  I have an additional suggestion: we treat tests that do not explicitly
> specify a language standard as testing *all* language modes. By default, we
> continue to run them only in the default language mode of the clang driver,
> but we:
>
>  -- Add a driver and cc1 flag to set a default language mode for each
> language
>
>  -- Add a buildbot that runs all tests with the default language mode set
> to each possible value
>
>
>
> This will prevent us from losing most of our C99 test coverage when we
> switch our default (and would also prevent us from losing most of our C++98
> test coverage if/when we switch our default C++ language mode to C++11).
> The added driver flag might also be useful to people who aren't ready for
> our new default yet.
>
>
>
> For the new flag, how about -std-default=c99 ?
>
>
>
> Seems like sufficient lit.cfg magic could vary the substitution of the
> %clang[_cc1] variables to supply -std=whatever.  As long as Clang's -std
> option parsing takes the last-one-specified without complaint, any test
> that explicitly specified -std would still obey that option.  No clang
> changes needed. One bot per non-default-dialect would be sufficient.
>

That doesn't work: we reject -std=c99 for C++ compiles, and reject
-std=c++98 for C compiles. I believe that's the correct behaviour. What we
want to say is "use this language standard by default for C compilations"
in a way that doesn't break if the compilation is C++. That's actually a
useful feature independent of any changes to how we test Clang.

There would be some period of pain while smoking out the tests that
> actually did depend on the older dialect.  As a data point, when Sony
> privately switched to default to C++11, we added –std to something like
> 100-150 tests to get them to pass again, but the rest were all fine.
>

That's an interesting datapoint. Did you find any bugs in this process, or
were all the changes between C++98 and C++11 modes things like extension
warnings going away?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141016/d05f544f/attachment.html>


More information about the cfe-dev mailing list