[llvm-branch-commits] [cfe-branch] r71625 - in /cfe/branches/Apple/Dib: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDecl.cpp test/Sema/decl-invalid.c
Mike Stump
mrs at apple.com
Tue May 12 20:15:18 PDT 2009
Author: mrs
Date: Tue May 12 22:15:18 2009
New Revision: 71625
URL: http://llvm.org/viewvc/llvm-project?rev=71625&view=rev
Log:
Merge in 71599:
improve the diagnostic for uses of the GCC "global variable in a register" extension.
This implements rdar://6880449 - improve diagnostic for usage of "global register variable" GCC extension
Modified:
cfe/branches/Apple/Dib/include/clang/Basic/DiagnosticSemaKinds.td
cfe/branches/Apple/Dib/lib/Sema/SemaDecl.cpp
cfe/branches/Apple/Dib/test/Sema/decl-invalid.c
Modified: cfe/branches/Apple/Dib/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/include/clang/Basic/DiagnosticSemaKinds.td?rev=71625&r1=71624&r2=71625&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/branches/Apple/Dib/include/clang/Basic/DiagnosticSemaKinds.td Tue May 12 22:15:18 2009
@@ -1020,6 +1020,8 @@
def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
def err_typecheck_sclass_fscope : Error<
"illegal storage class on file-scoped variable">;
+def err_unsupported_global_register : Error<
+ "global register variables are not supported">;
def err_typecheck_sclass_func : Error<"illegal storage class on function">;
def err_static_block_func : Error<
"function declared in block scope cannot have 'static' storage class">;
Modified: cfe/branches/Apple/Dib/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Sema/SemaDecl.cpp?rev=71625&r1=71624&r2=71625&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/lib/Sema/SemaDecl.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Sema/SemaDecl.cpp Tue May 12 22:15:18 2009
@@ -1729,7 +1729,13 @@
// C99 6.9p2: The storage-class specifiers auto and register shall not
// appear in the declaration specifiers in an external declaration.
if (SC == VarDecl::Auto || SC == VarDecl::Register) {
- Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_fscope);
+
+ // If this is a register variable with an asm label specified, then this
+ // is a GNU extension.
+ if (SC == VarDecl::Register && D.getAsmLabel())
+ Diag(D.getIdentifierLoc(), diag::err_unsupported_global_register);
+ else
+ Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_fscope);
D.setInvalidType();
}
}
Modified: cfe/branches/Apple/Dib/test/Sema/decl-invalid.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/Sema/decl-invalid.c?rev=71625&r1=71624&r2=71625&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/test/Sema/decl-invalid.c (original)
+++ cfe/branches/Apple/Dib/test/Sema/decl-invalid.c Tue May 12 22:15:18 2009
@@ -20,3 +20,10 @@
struct; // expected-error {{declaration of anonymous struct must be a definition}} // expected-error {{declaration does not declare anything}}
typedef int I;
I; // expected-error {{declaration does not declare anything}}
+
+
+
+// rdar://6880449
+register int test1; // expected-error {{illegal storage class on file-scoped variable}}
+register int test2 __asm__("edi"); // expected-error {{global register variables are not supported}}
+
More information about the llvm-branch-commits
mailing list