From d98e7cf7c10d3569b6d95af2d2f2ce11cd8ef5ba Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 12 May 2009 21:44:00 +0000 Subject: 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 llvm-svn: 71599 --- clang/lib/Sema/SemaDecl.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'clang/lib/Sema/SemaDecl.cpp') diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index d8b6f45e37a..b233021c42b 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1742,7 +1742,13 @@ Sema::ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC, // 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(); } } -- cgit v1.2.3