Second Lit tests C++11 compatibility patch: using preprocessor to filter expected-error
Hi Clang developers, We here at Sony are continuing to update the Lit tests for C++ dialects compatibility. Attached is the second patch. (As a reference, here is the link to the discussion on the previous Lit patch. http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20150727/134667.html) In this second patch, there is 1 complicated change and 3 simple changes. Here is the complicated change first. test/Sema/switch-1.c This test verifies the diagnostics for integer overflows. Due to C++11's more strict requirements on constant-expressions in 5.19p2 [expr.const], The diagnostics have changed from "overflow in expression" to "not a constant expression". Usually we would create a C++11 version of the switch-1.c file. But here we propose a novel approach to "#ifdef" the expected diagnostics. (We hope to use this approach for all similar cases in the future.) Normally '// expected-error' does not honor any '#ifdef'. But if we first preprocess the source into a temporary file, only the valid '#ifdef' sections remain. We then run the preprocessed file at the desired dialect. The main downside to this approach is If the test fails, the errors are reported on the temporary file, not on the original file, and the line numbers of these two files do not match Here are the simple changes. test/Analysis/temp-obj-dtors-cfg-output.cpp This test verifies CFG dump for temporary destructors C++11 no longer has the following implicit cast. (ImplicitCastExpr, NoOp, const struct D) We modified the test using the #ifdef approach to have the preprocessor generate the desired CHECK lines. test/CodeCompletion/ordinary-name.cpp This test verifies for code completion patterns. Since C++11 has more keywords than C++98, We made this test to be C++98 specific, and create a separate C++11 version. test/CodeCompletion/ordinary-name-cxx11.cpp This is the C++11 specific version of the code completion. This test added patterns for the following keywords: char16, char32, noexcept, nullptr, sizeof..., auto, decltype, char16_t, char32_t test/Sema/thread-specifier.c Tests for __thread specifier at various C++ dialects We made the default RUN line explicit to be at -std=c++98 If there is anything that seems confusing to you, please let me know. I would be more than happy to expand on the reasons for the these changes. Thanks, Charles lit_22.patch Description: lit_22.patch ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
RE: Second Lit tests C++11 compatibility patch: using preprocessor to filter expected-error
Hi Richard and Justin, > What's the upside to this approach? AFAICT it makes the test harder to read > and errors less informative due to pointing at the wrong lines, but (at least > in switch-1.c) it doesn't actually reduce any code duplication or anything > like that. What is this gaining us apart from not having to create one more > file? Thank you Justin. Our original intention was to get the Lit tests to run at any default C++ dialect. We first discovered that FileCheck does not respect #ifdef since it does not know about pre-defined macros. So we figured if we preprocess the source first, the preprocessor will filter the #ifdef sections and the output will feed nicely into FileCheck. The upside is the test can run at the default dialect in addition to explicitly specified dialect. The downside is, as you mentioned, the errors diagnostics would point to the wrong lines. > The only thing novel about this approach is using the preprocessor to achieve > it. -verify *does* respect #ifdef, and we have a lot of tests that rely on > that. Thank you Richard. We erroneously assumed that “// CHECK:” and “// expected-error” work the same way. But now we realized that assumption was wrong. In light this discussion, I have removed the preprocessing to temporary step for all tests. The attached patch (Lit_24.patch) revised 2 test fixes relative to the previous patch (Lit_22.patch) test/Analysis/temp-obj-dtors-cfg-output.cpp This test uses FileCheck to check for CFG dump. Instead of using #ifdef for the dialect specific “// CHECK:” lines, I have created 2 check-prefixes “CXX11” and “CXX98”. The pre-process step have been removed. test/Sema/switch-1.c This test uses –verify to check for integer overflows diagnostics. The pre-process step have been removed. The #ifdef is kept since it works with -verify. Please let me know how you feel about this patch. Sincerely, Charles From: meta...@gmail.com [mailto:meta...@gmail.com] On Behalf Of Richard Smith Sent: Monday, August 17, 2015 1:07 PM To: Li, Charles Cc: cfe-commits@lists.llvm.org Subject: Re: Second Lit tests C++11 compatibility patch: using preprocessor to filter expected-error On Mon, Aug 17, 2015 at 9:56 AM, Li, Charles via cfe-commits mailto:cfe-commits@lists.llvm.org>> wrote: Hi Clang developers, We here at Sony are continuing to update the Lit tests for C++ dialects compatibility. Attached is the second patch. (As a reference, here is the link to the discussion on the previous Lit patch. http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20150727/134667.html) In this second patch, there is 1 complicated change and 3 simple changes. Here is the complicated change first. test/Sema/switch-1.c This test verifies the diagnostics for integer overflows. Due to C++11’s more strict requirements on constant-expressions in 5.19p2 [expr.const], The diagnostics have changed from “overflow in expression” to “not a constant expression”. Usually we would create a C++11 version of the switch-1.c file. But here we propose a novel approach to “#ifdef” the expected diagnostics. (We hope to use this approach for all similar cases in the future.) Normally ‘// expected-error’ does not honor any ‘#ifdef’. But if we first preprocess the source into a temporary file, only the valid ‘#ifdef’ sections remain. We then run the preprocessed file at the desired dialect. The main downside to this approach is If the test fails, the errors are reported on the temporary file, not on the original file, and the line numbers of these two files do not match The only thing novel about this approach is using the preprocessor to achieve it. -verify *does* respect #ifdef, and we have a lot of tests that rely on that. Here are the simple changes. test/Analysis/temp-obj-dtors-cfg-output.cpp This test verifies CFG dump for temporary destructors C++11 no longer has the following implicit cast. (ImplicitCastExpr, NoOp, const struct D) We modified the test using the #ifdef approach to have the preprocessor generate the desired CHECK lines. test/CodeCompletion/ordinary-name.cpp This test verifies for code completion patterns. Since C++11 has more keywords than C++98, We made this test to be C++98 specific, and create a separate C++11 version. test/CodeCompletion/ordinary-name-cxx11.cpp This is the C++11 specific version of the code completion. This test added patterns for the following keywords: char16, char32, noexcept, nullptr, sizeof..., auto, decltype, char16_t, char32_t test/Sema/thread-specifier.c Tests for __thread specifier at various C++ dialects We made the default RUN line explicit to be at –std=c++98 If there is anything that seems confusing to you, please let me know. I would be more than happy to expand on the reasons for the these changes. Thanks, Charles
RE: Second Lit tests C++11 compatibility patch: using preprocessor to filter expected-error
Hi Richard, I have modified the “expected-“ lines as you requested. Cheers, Charles From: meta...@gmail.com [mailto:meta...@gmail.com] On Behalf Of Richard Smith Sent: Monday, August 17, 2015 5:41 PM To: Li, Charles Cc: Justin Bogner; cfe-commits@lists.llvm.org Subject: Re: Second Lit tests C++11 compatibility patch: using preprocessor to filter expected-error On Mon, Aug 17, 2015 at 5:15 PM, Li, Charles via cfe-commits mailto:cfe-commits@lists.llvm.org>> wrote: Hi Richard and Justin, > What's the upside to this approach? AFAICT it makes the test harder to read > and errors less informative due to pointing at the wrong lines, but (at least > in switch-1.c) it doesn't actually reduce any code duplication or anything > like that. What is this gaining us apart from not having to create one more > file? Thank you Justin. Our original intention was to get the Lit tests to run at any default C++ dialect. We first discovered that FileCheck does not respect #ifdef since it does not know about pre-defined macros. So we figured if we preprocess the source first, the preprocessor will filter the #ifdef sections and the output will feed nicely into FileCheck. The upside is the test can run at the default dialect in addition to explicitly specified dialect. The downside is, as you mentioned, the errors diagnostics would point to the wrong lines. > The only thing novel about this approach is using the preprocessor to achieve > it. -verify *does* respect #ifdef, and we have a lot of tests that rely on > that. Thank you Richard. We erroneously assumed that “// CHECK:” and “// expected-error” work the same way. But now we realized that assumption was wrong. In light this discussion, I have removed the preprocessing to temporary step for all tests. The attached patch (Lit_24.patch) revised 2 test fixes relative to the previous patch (Lit_22.patch) test/Analysis/temp-obj-dtors-cfg-output.cpp This test uses FileCheck to check for CFG dump. Instead of using #ifdef for the dialect specific “// CHECK:” lines, I have created 2 check-prefixes “CXX11” and “CXX98”. The pre-process step have been removed. test/Sema/switch-1.c This test uses –verify to check for integer overflows diagnostics. The pre-process step have been removed. The #ifdef is kept since it works with -verify. Instead of duplicating the code, you can do this: case blah: #if __cplusplus >= 201103L // expected-error@-2 {{error 2 lines above}} #else // expected-error@-4 {{error 4 lines above}} #endif Please let me know how you feel about this patch. Sincerely, Charles From: meta...@gmail.com<mailto:meta...@gmail.com> [mailto:meta...@gmail.com<mailto:meta...@gmail.com>] On Behalf Of Richard Smith Sent: Monday, August 17, 2015 1:07 PM To: Li, Charles Cc: cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org> Subject: Re: Second Lit tests C++11 compatibility patch: using preprocessor to filter expected-error On Mon, Aug 17, 2015 at 9:56 AM, Li, Charles via cfe-commits mailto:cfe-commits@lists.llvm.org>> wrote: Hi Clang developers, We here at Sony are continuing to update the Lit tests for C++ dialects compatibility. Attached is the second patch. (As a reference, here is the link to the discussion on the previous Lit patch. http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20150727/134667.html) In this second patch, there is 1 complicated change and 3 simple changes. Here is the complicated change first. test/Sema/switch-1.c This test verifies the diagnostics for integer overflows. Due to C++11’s more strict requirements on constant-expressions in 5.19p2 [expr.const], The diagnostics have changed from “overflow in expression” to “not a constant expression”. Usually we would create a C++11 version of the switch-1.c file. But here we propose a novel approach to “#ifdef” the expected diagnostics. (We hope to use this approach for all similar cases in the future.) Normally ‘// expected-error’ does not honor any ‘#ifdef’. But if we first preprocess the source into a temporary file, only the valid ‘#ifdef’ sections remain. We then run the preprocessed file at the desired dialect. The main downside to this approach is If the test fails, the errors are reported on the temporary file, not on the original file, and the line numbers of these two files do not match The only thing novel about this approach is using the preprocessor to achieve it. -verify *does* respect #ifdef, and we have a lot of tests that rely on that. Here are the simple changes. test/Analysis/temp-obj-dtors-cfg-output.cpp This test verifies CFG dump for temporary destructors C++11 no longer has the following implicit cast. (ImplicitCastExpr, NoOp, const struct D) We modified the test using the #ifdef approach to have the preprocessor generate the desired CHECK lines. test/CodeCompletion/ordinary-name.cpp This
RE: Second Lit tests C++11 compatibility patch: using preprocessor to filter expected-error
Hi Justin and Richard, >> +// RUN: %clang_cc1 -E -C -P -triple x86_64-apple-darwin10 %s > %t1.c >> +// RUN: %clang_cc1 -fsyntax-only -verify -triple >> +x86_64-apple-darwin10 %t1.c > I think you forgot to switch this one to stop preprocessing first. Thank you for catching this. I have removed it for this patch. > +#if (!defined(__cplusplus)) || (__cplusplus <= 199711L) // C or C++03 or > earlier modes > You can simplify that to: > #if __cplusplus <= 199711L > Otherwise, this LGTM. Thank you, I have made the simplifications > __cplusplus will expand to 0 inside a #if in C (as will any un#defined > identifier). As an aside, I did a "-E -dM" and __cplusplus is not in the macro dump. Likewise, having __cplusplus stand alone inside a t.c file will not cause preprocessor to replace it with 0. It appears the macro replacement of __cplusplus is context sensitive. Cheers, Charles -Original Message- From: Justin Bogner [mailto:jus...@justinbogner.com] On Behalf Of Justin Bogner Sent: Monday, August 17, 2015 9:28 PM To: Li, Charles Cc: Richard Smith; cfe-commits@lists.llvm.org Subject: Re: Second Lit tests C++11 compatibility patch: using preprocessor to filter expected-error "Li, Charles" writes: > Hi Richard, > > I have modified the “expected-“ lines as you requested. > > Cheers, > > Charles > > From: meta...@gmail.com [mailto:meta...@gmail.com] On Behalf Of > Richard Smith > Sent: Monday, August 17, 2015 5:41 PM > To: Li, Charles > Cc: Justin Bogner; cfe-commits@lists.llvm.org > Subject: Re: Second Lit tests C++11 compatibility patch: using > preprocessor to filter expected-error > > On Mon, Aug 17, 2015 at 5:15 PM, Li, Charles via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > > Hi Richard and Justin, > >> What's the upside to this approach? AFAICT it makes the test harder >> to read > and errors less informative due to pointing at the wrong lines, but > (at least in switch-1.c) it doesn't actually reduce any code > duplication or anything like that. What is this gaining us apart from > not having to create one more file? > > Thank you Justin. > > Our original intention was to get the Lit tests to run at any default > C++ dialect. > > We first discovered that FileCheck does not respect #ifdef since it > does not know about pre-defined macros. > > So we figured if we preprocess the source first, the preprocessor will > filter the #ifdef sections and the output will feed nicely into FileCheck. > > The upside is the test can run at the default dialect in addition to > explicitly specified dialect. > > The downside is, as you mentioned, the errors diagnostics would point > to the wrong lines. > >> The only thing novel about this approach is using the preprocessor to > achieve it. -verify *does* respect #ifdef, and we have a lot of tests > that rely on that. > > Thank you Richard. > > We erroneously assumed that “// CHECK:” and “// expected-error” work > the same way. > > But now we realized that assumption was wrong. > > In light this discussion, I have removed the preprocessing to > temporary step for all tests. > > The attached patch (Lit_24.patch) revised 2 test fixes relative to the > previous patch (Lit_22.patch) > > test/Analysis/temp-obj-dtors-cfg-output.cpp > > This test uses FileCheck to check for CFG dump. > > Instead of using #ifdef for the dialect specific “// CHECK:” > lines, > > I have created 2 check-prefixes “CXX11” and “CXX98”. > > The pre-process step have been removed. > > test/Sema/switch-1.c > > This test uses –verify to check for integer overflows diagnostics. > > The pre-process step have been removed. > > The #ifdef is kept since it works with -verify. > > Instead of duplicating the code, you can do this: > > case blah: > > #if __cplusplus >= 201103L > > // expected-error@-2 {{error 2 lines above}} > > #else > > // expected-error@-4 {{error 4 lines above}} > > #endif > > Please let me know how you feel about this patch. > > Sincerely, > > Charles > > From: meta...@gmail.com [mailto:meta...@gmail.com] On Behalf Of Richard > Smith > Sent: Monday, August 17, 2015 1:07 PM > To: Li, Charles > Cc: cfe-commits@lists.llvm.org > Subject: Re: Second Lit tests C++11 compatibility patch: using > preprocessor to filter expected-error > > On Mon, Aug 17, 2015 at 9:56 AM, Li, Charles via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > > Hi Clang developers, > > We here at Sony are continuing to update the Lit tests
[Tests] Making Lit Tests C++11 compatibile
Hello Clang developers, I am back again with another patch to make Clang Lit tests C++11 compatible. There are 26 tests in total. These are mainly diagnostics verifications where C++98/03 and C++11 differ. I tried to preserve as much coverage as possible. Unless otherwise stated, these tests have their RUN line expanded to run at: default C++ dialect, C++98 and C++11. Here are the description of what I did with each in the order as they appear in the patch. test/CXX/class.access/class.friend/p2-cxx03.cpp Only verify the following diagnostic on C++03 and earlier. "non-class friend type 'T' is a C++11 extension" test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp Only verify the following diagnostic on C++03 and earlier. "explicit conversion functions are a C++11 extension" test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp Only verify the following diagnostic on C++03 and earlier. "befriending enumeration type 'enum E' is a C++11 extension" test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp Verify for different diagnostic between C++03 and earlier vs C++11 and later C++03: conversion from string literal to 'char *' is deprecated C++11: ISO C++11 does not allow conversion from string literal to 'char *' test/CodeGen/ubsan-type-blacklist.cpp Relaxed FileCheck string to accommodate changes in LLVM-IR on actual argument type for "bar". C++03: %class.Bar* @bar C++11: { i8** }* @bar test/FixIt/fixit-vexing-parse.cpp Set this test to always run at C++98. C++11 coverage is provided by fixit-vexing-parse-cxx0x.cpp. test/SemaCXX/addr-of-overloaded-function.cpp Only verify the following diagnostic on C++03 and earlier. "default template arguments for a function template are a C++11 extension" test/SemaCXX/const-cast.cpp Only verify the following diagnostic on C++03 and earlier. "rvalue references are a C++11 extension" test/SemaCXX/convert-to-bool.cpp Only verify the following diagnostic on C++03 and earlier. "explicit conversion functions are a C++11 extension" test/SemaCXX/copy-initialization.cpp Only verify the following diagnostic on C++03 and earlier. "rvalue references are a C++11 extension" test/SemaCXX/cxx0x-return-init-list.cpp Force this test to always run at C++03 (-std=c++98). This test verifies for very basic initializer return support in C++98. It checks for the following diagnostic at C++03 "generalized initializer lists are a C++11 extension" test/SemaCXX/decltype-crash.cpp Force this test to always run at C++03 (-std=c++98). This test verifies against decltype crash back in 2009. test/SemaCXX/gnu-flags.cpp Only verify the following diagnostic on C++03 and earlier. "in-class initializer for static data member is not a constant expression; folding it to a constant is a GNU extension" test/SemaCXX/invalid-member-expr.cpp For code: pair z = minmax({}); Empty initializer list is valid in C++11, but since minmax is not defined anywhere in the program, compiler issues an error. Therefore, in C++03 and earlier, we check for diagnostic: "expected expression" In C++11 and later, we check for diagnostic: "use of undeclared identifier 'minmax'" test/SemaCXX/member-expr.cpp In C++11, "template" can be used outside of a template. Only verify the following diagnostic on C++03 and earlier. "'template' keyword outside of a template" test/SemaCXX/member-pointer.cpp Only verify the following diagnostic on C++03 and earlier. "use of enumeration in a nested name specifier is a C++11 extension" test/SemaCXX/new-array-size-conv.cpp Only verify the following two diagnostic on C++03 and earlier. "implicit conversion from array size expression of type 'ValueInt' to integral type 'int' is a C++11 extension" "implicit conversion from array size expression of type 'ValueEnum' to enumeration type 'E' is a C++11 extension" test/SemaCXX/offsetof.cpp Force this test to be C++98 only. Test offsetof-0x.cpp exists to verify for C++11 behavior Diagnostic change C++98: warning: offset of on non-POD type C++11: warning: offset of on non-standard-layout type test/SemaCXX/printf-block.cpp This test verifies the diagnostic when trying to pass a non-POD struct then access its string value. C++11 allows passing non-POD objects via va_arg (5.2.2/7). But since the object does not have a c_str() method. So the compiler will issue a warning on that Here are the different diagnostics we verify for. C++03: cannot pass non-POD object of type 'HasNoCStr' to variadic block; expected type from format string was 'char *' C++11: format specifies type 'char *' but the argument has type 'HasNoCStr' test/SemaCXX/undefined-internal.cpp Verify for different diagnostics depending on the dialect. C++03: "C++98 requires an accessible copy constructor" C++03: "copying parameter of type 'PR9323::(anonymous namespace)::Uncopyable' when binding a reference to a temporary would invoke an inaccessible constructor in C++98"
Lit Test C++11 Compatibility Patch #7
Hi Everyone, I am back again with another Lit test C++11 patch. This is the 7th patch. There are 13 tests in total. CXX/class.access/class.access.dcl/p1.cpp Access declarations are deprecated in C++11. As a result, there are 4 types of diagnostics changes: For simple access declarations, there is a change in diagnostics. C++98: warning: access declarations are deprecated; use using declarations instead C++11: error: ISO C++11 does not allow access declarations; use using declarations instead For Self-referential access declarations, there is also an additional error message. C++98: warning: access declarations are deprecated; use using declarations instead C++11: error: ISO C++11 does not allow access declarations; use using declarations instead C++11: error: using declaration refers to its own class For an access declaration of a non-base method, there is a different additional error message. C++98: warning: access declarations are deprecated; use using declarations instead C++11: error: ISO C++11 does not allow access declarations; use using declarations instead C++11: error: using declaration refers into 'Subclass::', which is not a base class of 'C' For self-referential access declaration with local declaration, there is the additional error message but one less note message. C++98: warning: access declarations are deprecated; use using declarations instead [-Wdeprecated] C++98: error: using declaration refers to its own class C++98: note: target of using declaration C++11: error: ISO C++11 does not allow access declarations; use using declarations instead C++11: error: using declaration refers to its own class CXX/temp/temp.spec/temp.expl.spec/p2.cpp Guard multiple instances of the following diagnostics to C++98. C++98: warning: first declaration of function template specialization of 'f0' outside namespace 'N0' is a C++11 extension C++98: note: explicitly specialized declaration is here CXX/temp/temp.spec/temp.expl.spec/p3.cpp Guard one instance of the following diagnostics to C++98. C++98: warning: first declaration of class template specialization of 'X' outside namespace 'N' is a C++11 extension C++98: note: explicitly specialized declaration is here CXX/temp/temp.spec/temp.explicit/p2.cpp CXX/temp/temp.spec/temp.explicit/p5.cpp In C++98 with -Wc++11-compat, Out-of-scope explicit instantiations of template is a Warning. In C++11, it is now an Error. C++98: warning: explicit instantiation of 'N::f1' must occur in namespace 'N' C++11: error: explicit instantiation of 'N::f1' must occur in namespace 'N' CodeGenCXX/debug-info-static-member.cpp In C++11, replace "const" with "constexpr" for in-class static initializer of non-integral type. Otherwise compiler would complain: C++11: error: in-class initializer for static data member of type 'const float' requires 'constexpr' specifier SemaCXX/dcl_init_aggr.cpp Diagnostic change due to initializer list C++98: error: non-aggregate type 'NonAggregate' cannot be initialized with an initializer list C++11: error no matching constructor for initialization of 'NonAggregate' note: candidate constructor (the implicit copy constructor) not viable note: candidate constructor (the implicit move constructor) not viable note: candidate constructor not viable Diagnostic Change C++98: conversion from string literal to 'char *' is deprecated C++11: ISO C++11 does not allow conversion from string literal to 'char *' Addition C++11 move constructor diagnostics C++11: note: candidate constructor (the implicit move constructor) not viable The next 2 lines caused a lot of diff. Source: TooFewError too_few_error = { 1 } C++98: error: no matching constructor for initialization of 'NoDefaultConstructor' note: candidate constructor not viable: requires 1 argument, but 0 were provided note: candidate constructor (the implicit copy constructor) not viable note: in implicit initialization of field 'nodef' with omitted initializer error: implicit default constructor for 'TooFewError' must explicitly initialize the member 'nodef' which does not have a default constructor note: member is declared here note: 'NoDefaultConstructor' declared here C++11: error: no matching constructor for initialization of 'NoDefaultConstructor' note: candidate constructor not viable: requires 1 argument, but 0 were provided note: candidate constructor (the implicit copy constructor) not viable note: candidate constructor (the implicit move constructor) not viable note: in implicit initialization of field 'nodef' with omitted initializer Source: TooFewError too_few_okay2[2] = { 1, 1 }; C++98: note: implicit default constructor for 'TooFewError' first
Lit test C++11 Compatibility Patch #4
Hi Everyone, Here is the forth Lit tests C++11 compatibility patch. This patch mainly added new diagnostics expected for C++11. There are 34 tests in total. They fall into 3 categories. [2 tests] New Warnings regarding storage class specifier "register"/"auto" being deprecated/not-allowed. [18 Tests] New Note "candidate constructor (the implicit move constructor) not viable" accompanying existing Error "no matching constructor" [14 Tests] New Note "candidate function (the implicit move assignment operator) not viable" accompanying existing Error "no viable overloaded '='" There is a walkthrough of each test CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp Added "move constructor" message CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp Added "move constructor" message Note: Also restricted expected Warning "inline namespaces are a C++11 feature" to C++98/03 and earlier CXX/basic/basic.scope/basic.scope.hiding/p2.cpp Added "move constructor" message CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp Added "move constructor" message CXX/dcl.dcl/dcl.spec/dcl.stc/p2.cpp Added "auto" and "register" message. The 2 messages are: 'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases 'register' storage class specifier is deprecated Note: The original run line has option "-Wno-c++0x-compat" This is the default behavior in C++98/03, "-Wno-c++0x-compat" has no effect in C++11. To avoid confusion, I kept the original run line as is and added 3 more run lines which are default, C++98 and C++11 CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp Added "move constructor" message CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp Added "move constructor" message CXX/temp/temp.decls/temp.class/temp.static/p1.cpp Added "move constructor" message CXX/temp/temp.param/p3.cpp Added "move constructor" message CXX/temp/temp.spec/temp.explicit/p1.cpp Added "move constructor" message OpenMP/for_reduction_messages.cpp Added "move assignment operator" message OpenMP/for_simd_reduction_messages.cpp Added "move assignment operator" message OpenMP/parallel_for_reduction_messages.cpp Added "move assignment operator" message OpenMP/parallel_for_simd_reduction_messages.cpp Added "move assignment operator" message OpenMP/parallel_reduction_messages.cpp Added "move assignment operator" message OpenMP/parallel_sections_reduction_messages.cpp Added "move assignment operator" message OpenMP/sections_reduction_messages.cpp Added "move assignment operator" message OpenMP/simd_reduction_messages.cpp Added "move assignment operator" message OpenMP/teams_reduction_messages.cpp Added "move assignment operator" message SemaCXX/constructor-initializer.cpp Added "move constructor" message SemaCXX/converting-constructor.cpp Added "move constructor" message SemaCXX/crashes.cpp Added "move constructor" message SemaCXX/default1.cpp Added "move constructor" message SemaCXX/direct-initializer.cpp Added "move constructor" message SemaCXX/expressions.cpp Added "'register' storage class specifier is deprecated" message SemaCXX/namespace.cpp Added "move assignment operator" message SemaCXX/overload-call-copycon.cpp Added "move constructor" message SemaCXX/overloaded-builtin-operators.cpp Added "move assignment operator" message SemaCXX/vector.cpp Added "move assignment operator" message SemaTemplate/class-template-ctor-initializer.cpp Added "move assignment operator" message SemaTemplate/constructor-template.cpp Added "move constructor" message SemaTemplate/default-expr-arguments.cpp Added "move constructor" message SemaTemplate/fun-template-def.cpp Added "move constructor" message SemaTemplate/qualified-names-diag.cpp Added "move assignment operator" message All feed backs are welcome. Thank you. Charles Li 400.patch Description: 400.patch ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Lit Test C++11 compatibility patch #5
Hi Everyone, I am continuing with updating Lit tests to be C++11 compatible. Here is the fifth patch. This patch contains 20 tests. These are mostly diagnostics changes due to new C++11 features and changes in the standard. Here are the explanations for each test in the order that they appear in the patch. CXX/class/class.nest/p1.cpp Sizeof has been extended to apply to non-static data members without an object [n2253]. Restrict the following to C++98/03. error: invalid use of non-static data member 'x' Parser/cxx-casting.cpp Restrict Digraph errors to C++98/03. C++98 error: found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'? Parser/cxx-reference.cpp rvalue references is now support Restrict the following to C++98/03. C++98 Warning rvalue references are a C++11 extension Parser/cxx-template-argument.cpp Consecutive right angle brackets is no longer a syntax error in C++11 Restrict the following to C++98/03 C++98: error: a space is required between consecutive right angle brackets (use '> >') Parser/cxx-typeof.cpp Using __typeof to derive the type of a non-static data member was an Error in C++98/03. It is now accepted in in C++11. Note 1: I could not find GCC documentation on this change, but given C++11 has decltype now works on non-static data members, this appears logical. Note 2: This test uses GNU extension "typeof". Therefore the Runs line are expanded with -std=gnu++98 and "-std=gnu++11" instead of the usual "-std=c++98" and "-std=c++11" Parser/objc-init.m Added C++11 error and note diagnostics on narrowing conversion. Error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list Note: insert an explicit cast to silence this issue *Please Note: Since this is an Objective-C test, the Run line has not been changed. Parser/objcxx-lambda-expressions-neg.mm []{}; is now an valid Lambda expression. Restrict "warning: expected expression" to C++98/03. SemaCXX/decl-expr-ambiguity.cpp Change in ambiguity diagnostics due to introduction of initializer list. C++11 has 1 extra Note following the pre-existing warning warning: empty parentheses interpreted as a function declaration [-Wvexing-parse] note: replace parentheses with an initializer to declare a variable *Note: The Run lines are left as-is because this test verifies for default diagnostic for "typeof" Diagnostics will change if I explicitly specify any dialect. Default (no -std= flag): error: extension used [-Werror,-Wlanguage-extension-token] C++ (-std=c++ flag): error: expected '(' for function-style cast or type construction GNU++ (-std=gnu++ flag): No diagnostic. SemaCXX/overload-call.cpp This change has 3 separate issues. First two are overload resolutions. Last one is C++98/03 specific diagnostic. 1. When the actual arg is a string literal and 2 candidate functions exist. One with formal argument "char *", the other with "bool" In C++98/03, Clang picks "char *" and issues a deprecated writable wring diagnostics. In C++11 , Clang uses picks the "bool" candidate and issues a return type miss match diagnostics. Default converstion from "const char *" to "bool" came from C++11 standard 4.12\1 [conv.bool] Reference: http://stackoverflow.com/questions/26413951/overloaded-bool-string-ambiguity The difference in diagnostics are as follows: C++98 (argument type mismatch): conversion from string literal to 'char *' is deprecated C++11 (return type mismatch): cannot initialize a variable of type 'int *' with an rvalue of type 'double *' 2. Similar to point 1. This time the 2 overloaded functions have formal args "char *" and "void *". In this case Clang picks "char *" but issues a slightly different error: C++98 warning: conversion from string literal to 'char *' is deprecated C++11 warning: ISO C++11 does not allow conversion from string literal to 'char *' 3. Restrict the following diagnostics to C++98/03 Warning: rvalue references are a C++11 extension Warning: deleted function definitions are a C++11 extension SemaCXX/pragma-init_seg.cpp In C++11 Clang issues an additional note follow pre-existing error. Add the following Note to C++11. Error: initializer for thread-local variable must be a constant expression Note: use 'thread_local' to allow this SemaCXX/typo-correction-delayed.cpp C++11 allows initializer list to be pass as actual arguments. Restrict the following to C++98 error: expected expression SemaCXX/unknown-type-name.cpp Restrict the following to C++98 Warning: deleted function definitions are a C++11 extension SemaCXX/writable-strings-deprecated.cpp Writable strings generates different diagno
Lit C++11 Compatibility Patch #6
Hello Everyone, Here is the 6th Lit tests C++11 compatibility patch. It is super simple this time. 17 OpenMP tests have their expected diagnostics updated. The changes to each file are identical. C++11 has expanded diagnostics when an expression is not an integral constant expression. C++11 has different Error messages from C++98 (3 instances) C++98: error: expression is not an integral constant expression C++11: error: integral constant expression must have integral or unscoped enumeration type, not 'char *' C++11 has added the following note to pre-existing Error message (4 instances) Pre-existing: error: expression is not an integral constant expression C++11: note: non-constexpr function 'foobool' cannot be used in a constant expression C++11: note: declared here Here is a list of the 17 files in this patch. test/OpenMP/for_collapse_messages.cpp test/OpenMP/for_ordered_clause.cpp test/OpenMP/for_simd_collapse_messages.cpp test/OpenMP/for_simd_safelen_messages.cpp test/OpenMP/for_simd_simdlen_messages.cpp test/OpenMP/parallel_for_collapse_messages.cpp test/OpenMP/parallel_for_ordered_messages.cpp test/OpenMP/parallel_for_simd_collapse_messages.cpp test/OpenMP/parallel_for_simd_safelen_messages.cpp test/OpenMP/parallel_for_simd_simdlen_messages.cpp test/OpenMP/simd_collapse_messages.cpp test/OpenMP/simd_safelen_messages.cpp test/OpenMP/simd_simdlen_messages.cpp test/OpenMP/taskloop_collapse_messages.cpp test/OpenMP/taskloop_simd_collapse_messages.cpp test/OpenMP/taskloop_simd_safelen_messages.cpp test/OpenMP/taskloop_simd_simdlen_messages.cpp Cheers, Charles Li 600.patch Description: 600.patch ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits