Making Clang Lit tests C++11 compatible

Nico Weber thakis at chromium.org
Fri Jul 31 09:46:15 PDT 2015


Looks fine. I think these kinds of changes are simple enough that you can
land them for post-commit review.

Forcing c++98 for the ms-extensions test is a bit strange since microsoft
mode always enables c++11 (or even 14). Maybe we should just delete that
test, it's probably from a while ago.

On Thu, Jul 30, 2015 at 4:14 PM, Li, Charles <
charles_li at playstation.sony.com> wrote:

> Hi Clang developers,
>
>
> We, here at Sony, have changed the default C++ language standard for
> PlayStation 4 to C++11 instead of C++98.
> When we ran the Clang Lit tests, 231 tests failed.
> We are currently going through and fixing each test to allow for flexible
> compatibility with current and future C++ standards.
>
> Attached is the first fix. This simple fix made the C++ standard dialect
> explicit on 5 five test file.
> Here are a brief description for each change:
>
>   test/Lexer/cxx0x_keyword_as_cxx98.cpp
>     This test checks for diagnostics on C++11 keywords when compiling on
> older dialects.
>     For this test, I have made the C++ dialects explicit to C++98 and
> C++03.
>
>   test/Lexer/has_feature_cxx0x.cpp
>     This test checks for supported language features when compiling at
> various dialects.
>     For this test, I have made the C++ dialects explicit to C++98 and
> C++03.
>
>   test/Lexer/ms-extensions.cpp
>     This test checks for the Warning diagnostic on user-defined literal on
> older dialects.
>     For this test, I have made the C++ dialects explicit to C++98 and
> C++03.
>
>   test/Preprocessor/macro-reserved.cpp
>     This test checks for reserved keywords prior to C++11.
>     For this test, I have made the C++ dialects explicit to C++98 and
> C++03.
>
>   test/Preprocessor/macro-reserved-cxx11.cpp
>     This test checks for reserved keywords on C++11.
>     Since C++11 and C++14 share the same keywords, I have added a RUN line
> for C++14.
>     Please let me know if you feel a separate test file should be created
> for C++14.
>
>
> All of the above 5 tests are relatively straight forward tests checking
> for C++ dialect specific behavior.
> I personally feel adding "-std=" flags to the RUN line of each of the
> above test will suffice.
> While there are other tests that can be fixed with such a straight forward
> fix,
> many of the other tests will require more nuanced modifications to the
> test code in order to
> accommodate for finer differences in the C++ dialects.
> I hope to expand the scope of the discussion as this work progresses.
>
> The final goal of this project, to be submitted over several patches, is
> to, without breaking the
> current state, arrive at a situation where the clang lit tests can pass,
> with no further
> changes to tests, if the default language dialect is changed from C++98 to
> C++11.
>
> This will make the task of changing the default dialect a trivial step,
> whenever it happens.
> Meanwhile, it will help any current clang users who are setting the
> default to C++11, as we do.
>
>
> Sincerely,
> Charles Li
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150731/37e737e9/attachment.html>


More information about the cfe-commits mailing list