зеркало из https://github.com/microsoft/clang-1.git
-Wmissing-prototypes shouldn't complain about main() missing a prototype.
Fixes <rdar://problem/6759522> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68611 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
edfa02b85b
Коммит
2c2d9dc382
|
@ -2793,7 +2793,8 @@ Sema::DeclPtrTy Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclPtrTy D) {
|
|||
// prototype declaration. This warning is issued even if the
|
||||
// definition itself provides a prototype. The aim is to detect
|
||||
// global functions that fail to be declared in header files.
|
||||
if (!FD->isInvalidDecl() && FD->isGlobal() && !isa<CXXMethodDecl>(FD)) {
|
||||
if (!FD->isInvalidDecl() && FD->isGlobal() && !isa<CXXMethodDecl>(FD) &&
|
||||
!FD->isMain()) {
|
||||
bool MissingPrototype = true;
|
||||
for (const FunctionDecl *Prev = FD->getPreviousDeclaration();
|
||||
Prev; Prev = Prev->getPreviousDeclaration()) {
|
||||
|
|
|
@ -32,3 +32,5 @@ int f2(int);
|
|||
int f2();
|
||||
|
||||
int f2(int x) { return x; }
|
||||
|
||||
int main(void) { return 0; }
|
||||
|
|
Загрузка…
Ссылка в новой задаче