]> granicus.if.org Git - clang/commitdiff
Turn off -Wmissing-noreturn warning for blocks
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 3 Apr 2014 23:06:35 +0000 (23:06 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 3 Apr 2014 23:06:35 +0000 (23:06 +0000)
as there is no way to attach this attribute to the
block literal. // rdar://16274746

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205580 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/AnalysisBasedWarnings.cpp
test/Sema/return-noreturn.c

index 3e40485a8b17e980d8ae63e0456a4596b4f73999..a489e8c911b1e7597e9bb550ba11ec9c77373ea8 100644 (file)
@@ -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;
   }
 };
 
index 6d521eb017cb8499ca609307436aebb0f7d3695b..2aa0b91115b895c81de8e936de88a1c8d7843066 100644 (file)
@@ -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(;;)
+        ;
+     };
+}
+