OSDN Git Service

2004-09-21 Daniel Berlin <dberlin@dberlin.org>
authordberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 21 Sep 2004 15:42:44 +0000 (15:42 +0000)
committerdberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 21 Sep 2004 15:42:44 +0000 (15:42 +0000)
* c-typeck.c (build_function_call): Give name of object
we are attempting to call in error message.
* c-objc-common.c (c_tree_printer): Call pp_expression,
not return false, for 'E' case.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87809 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-objc-common.c
gcc/c-typeck.c
gcc/testsuite/gcc.dg/20040920-1.c [new file with mode: 0644]

index 801759d..7d034c4 100644 (file)
@@ -1,3 +1,10 @@
+2004-09-21  Daniel Berlin <dberlin@dberlin.org>
+       
+       * c-typeck.c (build_function_call): Give name of object
+       we are attempting to call in error message.
+       * c-objc-common.c (c_tree_printer): Call pp_expression,
+       not return false, for 'E' case.
+
 2004-09-21  Steven Bosscher  <stevenb@suse.de>
 
        PR rtl-optimization/17482
index d59aed1..0259fe5 100644 (file)
@@ -235,7 +235,7 @@ c_tree_printer (pretty_printer *pp, text_info *text)
       if (TREE_CODE (t) == IDENTIFIER_NODE)
        n = IDENTIFIER_POINTER (t);
       else
-        return false;
+       pp_expression (cpp, t);
       break;
 
     default:
index a7f7763..d94965b 100644 (file)
@@ -1926,7 +1926,7 @@ build_function_call (tree function, tree params)
   if (!(TREE_CODE (fntype) == POINTER_TYPE
        && TREE_CODE (TREE_TYPE (fntype)) == FUNCTION_TYPE))
     {
-      error ("called object is not a function");
+      error ("called object %qE is not a function", function);
       return error_mark_node;
     }
 
diff --git a/gcc/testsuite/gcc.dg/20040920-1.c b/gcc/testsuite/gcc.dg/20040920-1.c
new file mode 100644 (file)
index 0000000..8813963
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+int bob;
+struct a
+{
+  int foo;
+};
+int main(void)
+{
+  struct a bar;
+  bob(5); /* { dg-error "called object 'bob\\({anonymous}\\)' is not a function" } */
+  bar.foo(); /* { dg-error "called object 'bar.foo\\({anonymous}\\)' is not a function" } */
+}