[cfe-commits] r68611 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/warn-missing-prototypes.c
Douglas Gregor
dgregor at apple.com
Wed Apr 8 08:21:36 PDT 2009
Author: dgregor
Date: Wed Apr 8 10:21:36 2009
New Revision: 68611
URL: http://llvm.org/viewvc/llvm-project?rev=68611&view=rev
Log:
-Wmissing-prototypes shouldn't complain about main() missing a prototype.
Fixes <rdar://problem/6759522>
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/warn-missing-prototypes.c
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=68611&r1=68610&r2=68611&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Apr 8 10:21:36 2009
@@ -2793,7 +2793,8 @@
// 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()) {
Modified: cfe/trunk/test/Sema/warn-missing-prototypes.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-missing-prototypes.c?rev=68611&r1=68610&r2=68611&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-missing-prototypes.c (original)
+++ cfe/trunk/test/Sema/warn-missing-prototypes.c Wed Apr 8 10:21:36 2009
@@ -32,3 +32,5 @@
int f2();
int f2(int x) { return x; }
+
+int main(void) { return 0; }
More information about the cfe-commits
mailing list