[PATCH]: Make "called object is not a function" message give name of object

Daniel Berlin dberlin@dberlin.org
Tue Sep 21 14:39:00 GMT 2004


On Sep 21, 2004, at 10:20 AM, Gabriel Dos Reis wrote:

> Daniel Berlin <dberlin@dberlin.org> writes:
>
> | On Sep 21, 2004, at 10:01 AM, Gabriel Dos Reis wrote:
> |
> | > Daniel Berlin <dberlin@dberlin.org> writes:
> | >
> | > | On Sep 20, 2004, at 7:28 PM, Joseph S. Myers wrote:
> | > |
> | > | > On Mon, 20 Sep 2004, Zack Weinberg wrote:
> | > | >
> | > | >> Daniel Berlin <dberlin@dberlin.org> writes:
> | > | >>
> | > | >>> +	error ("called object %qs is not a function",
> | > | >>> +	       IDENTIFIER_POINTER (DECL_NAME (function)));
> | > | >>
> | > | >> Make that ("called object %qD is not a function", function);
> | > | >>
> | > | >> And I don't think you need to worry about DECL_NAME being 
> null.
> | > | >
> | > | > It is however necessary to allow for the called object not 
> being a
> | > | > DECL at
> | > | > all,
> | >
> | > It that case, it should be %qE, which is deals with both decl and
> | > non-decls.  It should be the prefered formatting option.
> |
> | %qE doesn't work, unfortunately, for exactly the reason Joseph said.
> | Look at c-objc-common.c:c_tree_printer, for case 'E', and you'll see
> | why.
>
> It should not be
>
>     case 'E':
>       if (TREE_CODE (t) == IDENTIFIER_NODE)
>         n = IDENTIFIER_POINTER (t);
>       else
>         return false;
>       break;
>
> It should be calling pp_expression (cpp, t), which is the proper fix.
>

Okay. that works.
Or at least, close enough.
The error message is now "called object 'bob({anonymous})' is not a 
function'.
Here's an updated patch.
Is this okay?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cerrordiff.diff
Type: application/octet-stream
Size: 1952 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040921/67dd579c/attachment.obj>


More information about the Gcc-patches mailing list