From ebb79f2cbf0d3254b82a738e8e26b67c089dae45 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Thu, 3 Apr 2014 23:06:35 +0000 Subject: [PATCH] Turn off -Wmissing-noreturn warning for blocks 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 | 8 ++------ test/Sema/return-noreturn.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp index 3e40485a8b..a489e8c911 100644 --- a/lib/Sema/AnalysisBasedWarnings.cpp +++ b/lib/Sema/AnalysisBasedWarnings.cpp @@ -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; } }; diff --git a/test/Sema/return-noreturn.c b/test/Sema/return-noreturn.c index 6d521eb017..2aa0b91115 100644 --- a/test/Sema/return-noreturn.c +++ b/test/Sema/return-noreturn.c @@ -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(;;) + ; + }; +} + -- 2.40.0