r254097 - P0001R1: 'register' storage class specifier is no longer permitted in C++1z.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 25 13:34:21 PST 2015
Author: rsmith
Date: Wed Nov 25 15:34:21 2015
New Revision: 254097
URL: http://llvm.org/viewvc/llvm-project?rev=254097&view=rev
Log:
P0001R1: 'register' storage class specifier is no longer permitted in C++1z.
We will still allow it in system headers, in macros from system headers, when
combined with an 'asm' label, and under the flag -Wno-register.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/deprecated.cpp
cfe/trunk/www/cxx_status.html
Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=254097&r1=254096&r2=254097&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Wed Nov 25 15:34:21 2015
@@ -187,6 +187,8 @@ def CXX14Compat : DiagGroup<"c++14-compa
def CXX14CompatPedantic : DiagGroup<"c++14-compat-pedantic",
[CXXPre1zCompatPedantic]>;
+def CXX1zCompat : DiagGroup<"c++1z-compat", [DeprecatedRegister]>;
+
def : DiagGroup<"effc++">;
def DivZero : DiagGroup<"division-by-zero">;
def ExitTimeDestructors : DiagGroup<"exit-time-destructors">;
@@ -314,6 +316,7 @@ def : DiagGroup<"redundant-decls">;
def RedeclaredClassMember : DiagGroup<"redeclared-class-member">;
def GNURedeclaredEnum : DiagGroup<"gnu-redeclared-enum">;
def RedundantMove : DiagGroup<"redundant-move">;
+def Register : DiagGroup<"register", [DeprecatedRegister]>;
def ReturnStackAddress : DiagGroup<"return-stack-address">;
def ReturnTypeCLinkage : DiagGroup<"return-type-c-linkage">;
def ReturnType : DiagGroup<"return-type", [ReturnTypeCLinkage]>;
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=254097&r1=254096&r2=254097&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Nov 25 15:34:21 2015
@@ -213,8 +213,11 @@ def warn_auto_storage_class : Warning<
InGroup<CXX11Compat>, DefaultIgnore;
def warn_deprecated_register : Warning<
- "'register' storage class specifier is deprecated">,
- InGroup<DeprecatedRegister>;
+ "'register' storage class specifier is deprecated "
+ "and incompatible with C++1z">, InGroup<DeprecatedRegister>;
+def ext_register_storage_class : ExtWarn<
+ "ISO C++1z does not allow 'register' storage class specifier">,
+ DefaultError, InGroup<Register>;
def err_invalid_decl_spec_combination : Error<
"cannot combine with previous '%0' declaration specifier">;
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=254097&r1=254096&r2=254097&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Nov 25 15:34:21 2015
@@ -5709,7 +5709,8 @@ Sema::ActOnVariableDeclarator(Scope *S,
// Suppress the warning in system macros, it's used in macros in some
// popular C system headers, such as in glibc's htonl() macro.
Diag(D.getDeclSpec().getStorageClassSpecLoc(),
- diag::warn_deprecated_register)
+ getLangOpts().CPlusPlus1z ? diag::ext_register_storage_class
+ : diag::warn_deprecated_register)
<< FixItHint::CreateRemoval(D.getDeclSpec().getStorageClassSpecLoc());
}
Modified: cfe/trunk/test/SemaCXX/deprecated.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/deprecated.cpp?rev=254097&r1=254096&r2=254097&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/deprecated.cpp (original)
+++ cfe/trunk/test/SemaCXX/deprecated.cpp Wed Nov 25 15:34:21 2015
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -std=c++98 %s -Wdeprecated -verify -triple x86_64-linux-gnu
// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify -triple x86_64-linux-gnu
// RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify -triple x86_64-linux-gnu
+// RUN: %clang_cc1 -std=c++1z %s -Wdeprecated -verify -triple x86_64-linux-gnu
// RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify -triple x86_64-linux-gnu -Wno-deprecated-register -DNO_DEPRECATED_FLAGS
@@ -17,8 +18,10 @@ void h() throw(...);
void stuff() {
register int n;
-#if __cplusplus >= 201103L && !defined(NO_DEPRECATED_FLAGS)
- // expected-warning at -2 {{'register' storage class specifier is deprecated}}
+#if __cplusplus > 201402L
+ // expected-error at -2 {{ISO C++1z does not allow 'register' storage class specifier}}
+#elif __cplusplus >= 201103L && !defined(NO_DEPRECATED_FLAGS)
+ // expected-warning at -4 {{'register' storage class specifier is deprecated}}
#endif
register int m asm("rbx"); // no-warning
Modified: cfe/trunk/www/cxx_status.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=254097&r1=254096&r2=254097&view=diff
==============================================================================
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Wed Nov 25 15:34:21 2015
@@ -596,7 +596,7 @@ as the draft C++1z standard evolves.</p>
<tr>
<td>Remove deprecated <tt>register</tt> storage class</td>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0001r1.html">P0001R1</a></td>
- <td class="none" align="center">No</td>
+ <td class="svn" align="center">Clang 3.8</td>
</tr>
<tr>
<td>Remove deprecated <tt>bool</tt> increment</td>
More information about the cfe-commits
mailing list