<div dir="ltr">On Fri, Jun 14, 2013 at 2:06 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Fri, Jun 14, 2013 at 11:45 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
> On Wed, Jun 12, 2013 at 7:02 PM, Richard Smith<br>
> <<a href="mailto:richard-llvm@metafoo.co.uk">richard-llvm@metafoo.co.uk</a>> wrote:<br>
>> Author: rsmith<br>
>> Date: Wed Jun 12 21:02:51 2013<br>
>> New Revision: 183881<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=183881&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=183881&view=rev</a><br>
>> Log:<br>
>> Add -Wdeprecated warnings and fixits for things deprecated in C++11:<br>
>> - 'register' storage class<br>
><br>
> This is firing in system headers while building compiler-rt. Should we<br>
> suppress it in system headers?<br>
<br>
</div>Well, it should already be suppressed in system headers, but it looks<br>
like we should also give this the special suppress-in-system-macros<br>
treatment. Done in r184005.<br></blockquote><div><br></div><div style>Is this a useful warning? Code generated by flex for example contains register variables, and there doesn't seem much harm in that. Should this be in -pedantic?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
> .../llvm/src/projects/compiler-rt/lib/msan/tests/msan_test.cc:661:25:<br>
> warning: 'register' storage class specifier is deprecated<br>
> [-Wdeprecated]<br>
> sai.sin_addr.s_addr = htonl(INADDR_LOOPBACK);<br>
> ^<br>
> /usr/include/netinet/in.h:393:21: note: expanded from macro 'htonl'<br>
> # define htonl(x) __bswap_32 (x)<br>
> ^<br>
> /usr/include/x86_64-linux-gnu/bits/byteswap.h:71:10: note: expanded<br>
> from macro '__bswap_32'<br>
> ({ register unsigned int __v, __x = (x); \<br>
> ^<br>
> 1 warning generated.<br>
><br>
>> - dynamic exception specifications<br>
>><br>
>> Only the former check is enabled by default for now (the latter might be quite noisy).<br>
>><br>
>> Added:<br>
>> cfe/trunk/test/SemaCXX/deprecated.cpp<br>
>> Modified:<br>
>> cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td<br>
>> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
>> cfe/trunk/lib/Parse/ParseDecl.cpp<br>
>> cfe/trunk/lib/Parse/ParseDeclCXX.cpp<br>
>> cfe/trunk/test/CXX/class/class.friend/p6.cpp<br>
>> cfe/trunk/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp<br>
>> cfe/trunk/test/FixIt/fixit-cxx0x.cpp<br>
>> cfe/trunk/test/Sema/thread-specifier.c<br>
>> cfe/trunk/test/SemaCXX/attr-cxx0x.cpp<br>
>><br>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=183881&r1=183880&r2=183881&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=183881&r1=183880&r2=183881&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)<br>
>> +++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Wed Jun 12 21:02:51 2013<br>
>> @@ -309,6 +309,8 @@ def err_expected_class_name_not_template<br>
>> Error<"'typename' is redundant; base classes are implicitly types">;<br>
>> def err_unspecified_vla_size_with_static : Error<<br>
>> "'static' may not be used with an unspecified variable length array size">;<br>
>> +def warn_deprecated_register : Warning<<br>
>> + "'register' storage class specifier is deprecated">, InGroup<Deprecated>;<br>
>><br>
>> def err_expected_case_before_expression: Error<<br>
>> "expected 'case' keyword before expression">;<br>
>><br>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=183881&r1=183880&r2=183881&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=183881&r1=183880&r2=183881&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)<br>
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Jun 12 21:02:51 2013<br>
>> @@ -287,6 +287,10 @@ def note_using_decl : Note<"%select{|pre<br>
>> def warn_access_decl_deprecated : Warning<<br>
>> "access declarations are deprecated; use using declarations instead">,<br>
>> InGroup<Deprecated>;<br>
>> +def warn_exception_spec_deprecated : Warning<<br>
>> + "dynamic exception specifications are deprecated">,<br>
>> + InGroup<Deprecated>, DefaultIgnore;<br>
>> +def note_exception_spec_deprecated : Note<"use '%0' instead">;<br>
>><br>
>> def warn_global_constructor : Warning<<br>
>> "declaration requires a global constructor">,<br>
>><br>
>> Modified: cfe/trunk/lib/Parse/ParseDecl.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=183881&r1=183880&r2=183881&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=183881&r1=183880&r2=183881&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/lib/Parse/ParseDecl.cpp (original)<br>
>> +++ cfe/trunk/lib/Parse/ParseDecl.cpp Wed Jun 12 21:02:51 2013<br>
>> @@ -2771,6 +2771,9 @@ void Parser::ParseDeclarationSpecifiers(<br>
>> PrevSpec, DiagID);<br>
>> break;<br>
>> case tok::kw_register:<br>
>> + if (getLangOpts().CPlusPlus11)<br>
>> + Diag(Tok, diag::warn_deprecated_register)<br>
>> + << FixItHint::CreateRemoval(Tok.getLocation());<br>
>> isInvalid = DS.SetStorageClassSpec(Actions, DeclSpec::SCS_register, Loc,<br>
>> PrevSpec, DiagID);<br>
>> break;<br>
>><br>
>> Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=183881&r1=183880&r2=183881&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=183881&r1=183880&r2=183881&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)<br>
>> +++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Wed Jun 12 21:02:51 2013<br>
>> @@ -2893,6 +2893,16 @@ Parser::tryParseExceptionSpecification(<br>
>> return Result;<br>
>> }<br>
>><br>
>> +static void diagnoseDynamicExceptionSpecification(<br>
>> + Parser &P, const SourceRange &Range, bool IsNoexcept) {<br>
>> + if (P.getLangOpts().CPlusPlus11) {<br>
>> + const char *Replacement = IsNoexcept ? "noexcept" : "noexcept(false)";<br>
>> + P.Diag(Range.getBegin(), diag::warn_exception_spec_deprecated) << Range;<br>
>> + P.Diag(Range.getBegin(), diag::note_exception_spec_deprecated)<br>
>> + << Replacement << FixItHint::CreateReplacement(Range, Replacement);<br>
>> + }<br>
>> +}<br>
>> +<br>
>> /// ParseDynamicExceptionSpecification - Parse a C++<br>
>> /// dynamic-exception-specification (C++ [except.spec]).<br>
>> ///<br>
>> @@ -2926,6 +2936,7 @@ ExceptionSpecificationType Parser::Parse<br>
>> Diag(EllipsisLoc, diag::ext_ellipsis_exception_spec);<br>
>> T.consumeClose();<br>
>> SpecificationRange.setEnd(T.getCloseLocation());<br>
>> + diagnoseDynamicExceptionSpecification(*this, SpecificationRange, false);<br>
>> return EST_MSAny;<br>
>> }<br>
>><br>
>> @@ -2957,6 +2968,8 @@ ExceptionSpecificationType Parser::Parse<br>
>><br>
>> T.consumeClose();<br>
>> SpecificationRange.setEnd(T.getCloseLocation());<br>
>> + diagnoseDynamicExceptionSpecification(*this, SpecificationRange,<br>
>> + Exceptions.empty());<br>
>> return Exceptions.empty() ? EST_DynamicNone : EST_Dynamic;<br>
>> }<br>
>><br>
>><br>
>> Modified: cfe/trunk/test/CXX/class/class.friend/p6.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class/class.friend/p6.cpp?rev=183881&r1=183880&r2=183881&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class/class.friend/p6.cpp?rev=183881&r1=183880&r2=183881&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/test/CXX/class/class.friend/p6.cpp (original)<br>
>> +++ cfe/trunk/test/CXX/class/class.friend/p6.cpp Wed Jun 12 21:02:51 2013<br>
>> @@ -4,7 +4,11 @@<br>
>> class A {<br>
>> friend static class B; // expected-error {{'static' is invalid in friend declarations}}<br>
>> friend extern class C; // expected-error {{'extern' is invalid in friend declarations}}<br>
>> +#if __cplusplus < 201103L<br>
>> friend register class E; // expected-error {{'register' is invalid in friend declarations}}<br>
>> +#else<br>
>> + friend register class E; // expected-error {{'register' is invalid in friend declarations}} expected-warning {{deprecated}}<br>
>> +#endif<br>
>> friend mutable class F; // expected-error {{'mutable' is invalid in friend declarations}}<br>
>> friend typedef class G; // expected-error {{'typedef' is invalid in friend declarations}}<br>
>> friend __thread class G; // expected-error {{'__thread' is invalid in friend declarations}}<br>
>><br>
>> Modified: cfe/trunk/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp?rev=183881&r1=183880&r2=183881&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp?rev=183881&r1=183880&r2=183881&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp (original)<br>
>> +++ cfe/trunk/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp Wed Jun 12 21:02:51 2013<br>
>> @@ -117,7 +117,7 @@ void g() {<br>
>><br>
>> for (extern int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'extern'}}<br>
>> for (static int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'static'}}<br>
>> - for (register int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'register'}}<br>
>> + for (register int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'register'}} expected-warning {{deprecated}}<br>
>> for (constexpr int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'constexpr'}}<br>
>><br>
>> for (auto u : X::NoBeginADL()) { // expected-error {{invalid range expression of type 'X::NoBeginADL'; no viable 'begin' function available}}<br>
>><br>
>> Modified: cfe/trunk/test/FixIt/fixit-cxx0x.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit-cxx0x.cpp?rev=183881&r1=183880&r2=183881&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit-cxx0x.cpp?rev=183881&r1=183880&r2=183881&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/test/FixIt/fixit-cxx0x.cpp (original)<br>
>> +++ cfe/trunk/test/FixIt/fixit-cxx0x.cpp Wed Jun 12 21:02:51 2013<br>
>> @@ -132,3 +132,8 @@ namespace NonStaticConstexpr {<br>
>> }<br>
>> };<br>
>> }<br>
>> +<br>
>> +int RegisterVariable() {<br>
>> + register int n; // expected-warning {{'register' storage class specifier is deprecated}}<br>
>> + return n;<br>
>> +}<br>
>><br>
>> Modified: cfe/trunk/test/Sema/thread-specifier.c<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/thread-specifier.c?rev=183881&r1=183880&r2=183881&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/thread-specifier.c?rev=183881&r1=183880&r2=183881&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/test/Sema/thread-specifier.c (original)<br>
>> +++ cfe/trunk/test/Sema/thread-specifier.c Wed Jun 12 21:02:51 2013<br>
>> @@ -2,8 +2,8 @@<br>
>> // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DGNU<br>
>> // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic %s -DC11 -D__thread=_Thread_local<br>
>> // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DC11 -D__thread=_Thread_local<br>
>> -// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DCXX11 -D__thread=thread_local -std=c++11<br>
>> -// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DC11 -D__thread=_Thread_local -std=c++11<br>
>> +// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DCXX11 -D__thread=thread_local -std=c++11 -Wno-deprecated<br>
>> +// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DC11 -D__thread=_Thread_local -std=c++11 -Wno-deprecated<br>
>><br>
>> #ifdef __cplusplus<br>
>> // In C++, we define __private_extern__ to extern.<br>
>><br>
>> Modified: cfe/trunk/test/SemaCXX/attr-cxx0x.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-cxx0x.cpp?rev=183881&r1=183880&r2=183881&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-cxx0x.cpp?rev=183881&r1=183880&r2=183881&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/test/SemaCXX/attr-cxx0x.cpp (original)<br>
>> +++ cfe/trunk/test/SemaCXX/attr-cxx0x.cpp Wed Jun 12 21:02:51 2013<br>
>> @@ -12,7 +12,7 @@ struct align_member {<br>
>> };<br>
>><br>
>> void f(alignas(1) char c) { // expected-error {{'alignas' attribute cannot be applied to a function parameter}}<br>
>> - alignas(1) register char k; // expected-error {{'alignas' attribute cannot be applied to a variable with 'register' storage class}}<br>
>> + alignas(1) register char k; // expected-error {{'alignas' attribute cannot be applied to a variable with 'register' storage class}} expected-warning {{deprecated}}<br>
>> try {<br>
>> } catch (alignas(4) int n) { // expected-error {{'alignas' attribute cannot be applied to a 'catch' variable}}<br>
>> }<br>
>><br>
>> Added: cfe/trunk/test/SemaCXX/deprecated.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/deprecated.cpp?rev=183881&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/deprecated.cpp?rev=183881&view=auto</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/test/SemaCXX/deprecated.cpp (added)<br>
>> +++ cfe/trunk/test/SemaCXX/deprecated.cpp Wed Jun 12 21:02:51 2013<br>
>> @@ -0,0 +1,31 @@<br>
>> +// RUN: %clang_cc1 -std=c++98 %s -Wdeprecated -verify<br>
>> +// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify<br>
>> +// RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify<br>
>> +<br>
>> +void f() throw();<br>
>> +void g() throw(int);<br>
>> +void h() throw(...);<br>
>> +#if __cplusplus >= 201103L<br>
>> +// expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept' instead}}<br>
>> +// expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept(false)' instead}}<br>
>> +// expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept(false)' instead}}<br>
>> +#endif<br>
>> +<br>
>> +void stuff() {<br>
>> + register int n;<br>
>> +#if __cplusplus >= 201103L<br>
>> + // expected-warning@-2 {{'register' storage class specifier is deprecated}}<br>
>> +#endif<br>
>> +<br>
>> + bool b;<br>
>> + ++b; // expected-warning {{incrementing expression of type bool is deprecated}}<br>
>> +<br>
>> + // FIXME: This is ill-formed in C++11.<br>
>> + char *p = "foo"; // expected-warning {{conversion from string literal to 'char *' is deprecated}}<br>
>> +}<br>
>> +<br>
>> +struct S { int n; };<br>
>> +struct T : private S {<br>
>> + // FIXME: This is ill-formed in C++11.<br>
>> + S::n; // expected-warning {{access declarations are deprecated; use using declarations instead}}<br>
>> +};<br>
>><br>
>><br>
>> _______________________________________________<br>
>> cfe-commits mailing list<br>
>> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div></div>