Skip to content

Commit 42a8440

Browse files
committed
add an explanatory comment
1 parent 6421020 commit 42a8440

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16230,6 +16230,9 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
1623016230

1623116231
// If the function implicitly returns zero (like 'main') or is naked,
1623216232
// don't complain about missing return statements.
16233+
// Clang implicitly returns 0 in C89 mode, but that's considered an
16234+
// extension. The check is necessary to ensure the expected extension
16235+
// warning is emitted in C89 mode.
1623316236
if ((FD->hasImplicitReturnZero() &&
1623416237
(getLangOpts().CPlusPlus || getLangOpts().C99 || !FD->isMain())) ||
1623516238
FD->hasAttr<NakedAttr>())

0 commit comments

Comments
 (0)