[cfe-commits] r47236 - in /cfe/trunk: Sema/SemaDecl.cpp test/Parser/implicit-casts.c test/Sema/function.c test/Sema/predefined-function.c
Chris Lattner
sabre at nondot.org
Sun Feb 17 11:31:10 PST 2008
Author: lattner
Date: Sun Feb 17 13:31:09 2008
New Revision: 47236
URL: http://llvm.org/viewvc/llvm-project?rev=47236&view=rev
Log:
Fix PR2042. One remaining issue: we don't currently diagnose
int foobar(int);
int foobar() {}
which requires ifdef'ing out a testcase in predefined-function.c.
Modified:
cfe/trunk/Sema/SemaDecl.cpp
cfe/trunk/test/Parser/implicit-casts.c
cfe/trunk/test/Sema/function.c
cfe/trunk/test/Sema/predefined-function.c
Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=47236&r1=47235&r2=47236&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Sun Feb 17 13:31:09 2008
@@ -1010,10 +1010,11 @@
FTI.ArgInfo[i].TypeInfo = Context.IntTy.getAsOpaquePtr();
}
}
-
+
// Since this is a function definition, act as though we have information
// about the arguments.
- FTI.hasPrototype = true;
+ if (FTI.NumArgs)
+ FTI.hasPrototype = true;
} else {
// FIXME: Diagnose arguments without names in C.
Modified: cfe/trunk/test/Parser/implicit-casts.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/implicit-casts.c?rev=47236&r1=47235&r2=47236&view=diff
==============================================================================
--- cfe/trunk/test/Parser/implicit-casts.c (original)
+++ cfe/trunk/test/Parser/implicit-casts.c Sun Feb 17 13:31:09 2008
@@ -14,7 +14,7 @@
}
int test3() {
int a[2];
- a[0] = test3; // expected-warning{{incompatible pointer to integer conversion assigning 'int (void)', expected 'int'}}
+ a[0] = test3; // expected-warning{{incompatible pointer to integer conversion assigning 'int ()', expected 'int'}}
}
short x; void test4(char c) { x += c; }
int y; void test5(char c) { y += c; }
Modified: cfe/trunk/test/Sema/function.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/function.c?rev=47236&r1=47235&r2=47236&view=diff
==============================================================================
--- cfe/trunk/test/Sema/function.c (original)
+++ cfe/trunk/test/Sema/function.c Sun Feb 17 13:31:09 2008
@@ -25,3 +25,7 @@
int t9(int a, ); // expected-error {{expected parameter declarator}}
+// PR2042
+void t10(){}
+void t11(){t10(1);}
+
Modified: cfe/trunk/test/Sema/predefined-function.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/predefined-function.c?rev=47236&r1=47235&r2=47236&view=diff
==============================================================================
--- cfe/trunk/test/Sema/predefined-function.c (original)
+++ cfe/trunk/test/Sema/predefined-function.c Sun Feb 17 13:31:09 2008
@@ -20,16 +20,18 @@
{
return 0;
}
-int bar() // expected-error {{redefinition of 'bar'}} expected-error {{conflicting types for 'bar'}}
+int bar() // expected-error {{redefinition of 'bar'}}
{
return 0;
}
+#if 0
int foobar(int); // expected-error {{previous declaration is here}}
int foobar() // expected-error {{conflicting types for 'foobar'}}
{
return 0;
}
+#endif
int wibble(); // expected-error {{previous declaration is here}}
float wibble() // expected-error {{conflicting types for 'wibble'}}
More information about the cfe-commits
mailing list