mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-02 09:46:05 +00:00
Add support for -Wimplicit-function-declaration, rdar://5907433
llvm-svn: 50672
This commit is contained in:
parent
31ce28c561
commit
00e2607de2
@ -475,6 +475,9 @@ static llvm::cl::opt<bool>
|
||||
WarnUndefMacros("Wundef",
|
||||
llvm::cl::desc("Warn on use of undefined macros in #if's"));
|
||||
|
||||
static llvm::cl::opt<bool>
|
||||
WarnImplicitFunctionDeclaration("Wimplicit-function-declaration"
|
||||
"Warn about use of implicitly defined functions");
|
||||
|
||||
/// InitializeDiagnostics - Initialize the diagnostic object, based on the
|
||||
/// current command line option settings.
|
||||
@ -498,6 +501,10 @@ static void InitializeDiagnostics(Diagnostic &Diags) {
|
||||
if (!WarnUndefMacros)
|
||||
Diags.setDiagnosticMapping(diag::warn_pp_undef_identifier,diag::MAP_IGNORE);
|
||||
|
||||
if (!WarnImplicitFunctionDeclaration)
|
||||
Diags.setDiagnosticMapping(diag::warn_implicit_function_decl,
|
||||
diag::MAP_IGNORE);
|
||||
|
||||
if (MSExtensions) // MS allows unnamed struct/union fields.
|
||||
Diags.setDiagnosticMapping(diag::w_no_declarators, diag::MAP_IGNORE);
|
||||
|
||||
|
@ -1268,9 +1268,10 @@ Sema::DeclTy *Sema::ActOnFinishFunctionBody(DeclTy *D, StmtTy *Body) {
|
||||
/// call, forming a call to an implicitly defined function (per C99 6.5.1p2).
|
||||
ScopedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc,
|
||||
IdentifierInfo &II, Scope *S) {
|
||||
if (getLangOptions().C99) // Extension in C99.
|
||||
// Extension in C99. Legal in C90, but warn about it.
|
||||
if (getLangOptions().C99)
|
||||
Diag(Loc, diag::ext_implicit_function_decl, II.getName());
|
||||
else // Legal in C90, but warn about it.
|
||||
else
|
||||
Diag(Loc, diag::warn_implicit_function_decl, II.getName());
|
||||
|
||||
// FIXME: handle stuff like:
|
||||
|
Loading…
x
Reference in New Issue
Block a user