r205580 - Turn off -Wmissing-noreturn warning for blocks
Fariborz Jahanian
fjahanian at apple.com
Thu Apr 3 16:06:35 PDT 2014
Author: fjahanian
Date: Thu Apr 3 18:06:35 2014
New Revision: 205580
URL: http://llvm.org/viewvc/llvm-project?rev=205580&view=rev
Log:
Turn off -Wmissing-noreturn warning for blocks
as there is no way to attach this attribute to the
block literal. // rdar://16274746
Modified:
cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
cfe/trunk/test/Sema/return-noreturn.c
Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=205580&r1=205579&r2=205580&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original)
+++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Thu Apr 3 18:06:35 2014
@@ -413,8 +413,7 @@ struct CheckFallThroughDiagnostics {
diag::err_noreturn_block_has_return_expr;
D.diag_AlwaysFallThrough_ReturnsNonVoid =
diag::err_falloff_nonvoid_block;
- D.diag_NeverFallThroughOrReturn =
- diag::warn_suggest_noreturn_block;
+ D.diag_NeverFallThroughOrReturn = 0;
D.funMode = Block;
return D;
}
@@ -449,10 +448,7 @@ struct CheckFallThroughDiagnostics {
}
// For blocks / lambdas.
- return ReturnsVoid && !HasNoReturn
- && ((funMode == Lambda) ||
- D.getDiagnosticLevel(diag::warn_suggest_noreturn_block, FuncLoc)
- == DiagnosticsEngine::Ignored);
+ return ReturnsVoid && !HasNoReturn;
}
};
Modified: cfe/trunk/test/Sema/return-noreturn.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/return-noreturn.c?rev=205580&r1=205579&r2=205580&view=diff
==============================================================================
--- cfe/trunk/test/Sema/return-noreturn.c (original)
+++ cfe/trunk/test/Sema/return-noreturn.c Thu Apr 3 18:06:35 2014
@@ -2,7 +2,7 @@
int j;
void test1() { // expected-warning {{function 'test1' could be declared with attribute 'noreturn'}}
- ^ (void) { while (1) { } }(); // expected-warning {{block could be declared with attribute 'noreturn'}}
+ ^ (void) { while (1) { } }();
^ (void) { if (j) while (1) { } }();
while (1) { }
}
@@ -40,3 +40,13 @@ test4() {
_Noreturn void test5() {
test2_positive();
}
+
+// rdar://16274746
+void test6()
+{
+ (void)^{
+ for(;;)
+ ;
+ };
+}
+
More information about the cfe-commits
mailing list