From f0c721ad7cc43cb007beb8a55cb088f17a2a065b Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Tue, 21 Sep 2004 15:42:44 +0000 Subject: [PATCH] c-typeck.c (build_function_call): Give name of object we are attempting to call in error message. 2004-09-21 Daniel Berlin * 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. From-SVN: r87809 --- gcc/ChangeLog | 7 +++++++ gcc/c-objc-common.c | 2 +- gcc/c-typeck.c | 2 +- gcc/testsuite/gcc.dg/20040920-1.c | 12 ++++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/20040920-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 801759d5a89..7d034c47903 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-09-21 Daniel Berlin + + * 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 PR rtl-optimization/17482 diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c index d59aed10beb..0259fe5de60 100644 --- a/gcc/c-objc-common.c +++ b/gcc/c-objc-common.c @@ -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: diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index a7f776390dd..d94965b19a1 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -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 index 00000000000..8813963f973 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20040920-1.c @@ -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" } */ +} -- 2.30.2