]> granicus.if.org Git - clang/commitdiff
Fix PR2042. One remaining issue: we don't currently diagnose
authorChris Lattner <sabre@nondot.org>
Sun, 17 Feb 2008 19:31:09 +0000 (19:31 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 17 Feb 2008 19:31:09 +0000 (19:31 +0000)
 int foobar(int);
 int foobar() {}

which requires ifdef'ing out a testcase in predefined-function.c.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47236 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/SemaDecl.cpp
test/Parser/implicit-casts.c
test/Sema/function.c
test/Sema/predefined-function.c

index 24013cd9dd0ebc8cd5bda920532e026d8443af12..6a718aef9157c7123d7911d60447f3a997d1be27 100644 (file)
@@ -1010,10 +1010,11 @@ Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
         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.
     
index 1636f4993e457a0cf2a7f592d1513eea5a612b22..2e8e00018221ae7220f1c2a18b64cc11c28fa7b0 100644 (file)
@@ -14,7 +14,7 @@ void test2() {
 }
 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; }
index 8ef453581fc8f89be6e7d87d4b405ec1d1c71146..2a18dbb7050987e7e456a4c6b1e884cc58fc4849 100644 (file)
@@ -25,3 +25,7 @@ int t8(, int a);  // expected-error {{expected parameter declarator}}
 int t9(int a, );  // expected-error {{expected parameter declarator}}
 
 
+// PR2042
+void t10(){}
+void t11(){t10(1);}
+
index 1dcd1d38a28c29397553e12b0b6582ff8d60c7e7..daade82b465c23ef9e782a69fd28da62dde75ae9 100644 (file)
@@ -20,16 +20,18 @@ int bar(int i) // expected-error {{previous definition is here}}
 {
        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'}}