Skip to content

Commit b2c4dae

Browse files
authored
Disable check fall through for functions marked 'noreturn'
1 parent b03e3c7 commit b2c4dae

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16020,6 +16020,11 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
1602016020
if (FD->hasImplicitReturnZero() || FD->hasAttr<NakedAttr>())
1602116021
WP.disableCheckFallThrough();
1602216022

16023+
// If the function is marked 'noreturn', don't complain about missing
16024+
// return statements.
16025+
if (FD->isNoReturn())
16026+
WP.disableCheckFallThrough();
16027+
1602316028
// MSVC permits the use of pure specifier (=0) on function definition,
1602416029
// defined at class scope, warn about this non-standard construct.
1602516030
if (getLangOpts().MicrosoftExt && FD->isPure() && !FD->isOutOfLine())

0 commit comments

Comments
 (0)