r194850 - Diagnose C++11 attributes before fp_contract pragmas.
Richard Smith
richard-llvm at metafoo.co.uk
Fri Nov 15 13:10:54 PST 2013
Author: rsmith
Date: Fri Nov 15 15:10:54 2013
New Revision: 194850
URL: http://llvm.org/viewvc/llvm-project?rev=194850&view=rev
Log:
Diagnose C++11 attributes before fp_contract pragmas.
Modified:
cfe/trunk/lib/Parse/ParseStmt.cpp
cfe/trunk/test/Parser/cxx11-stmt-attributes.cpp
Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=194850&r1=194849&r2=194850&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Fri Nov 15 15:10:54 2013
@@ -327,6 +327,7 @@ Retry:
return StmtEmpty();
case tok::annot_pragma_fp_contract:
+ ProhibitAttributes(Attrs);
Diag(Tok, diag::err_pragma_fp_contract_scope);
ConsumeToken();
return StmtError();
Modified: cfe/trunk/test/Parser/cxx11-stmt-attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx11-stmt-attributes.cpp?rev=194850&r1=194849&r2=194850&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx11-stmt-attributes.cpp (original)
+++ cfe/trunk/test/Parser/cxx11-stmt-attributes.cpp Fri Nov 15 15:10:54 2013
@@ -76,4 +76,9 @@ void foo(int i) {
}
[[carries_dependency]] return; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
+
+ {
+ [[ ]] // expected-error {{an attribute list cannot appear here}}
+#pragma STDC FP_CONTRACT ON // expected-error {{can only appear at file scope or at the start of a compound statement}}
+ }
}
More information about the cfe-commits
mailing list