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

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


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.
In fact, it's even worse than just qD.



More information about the Gcc-patches mailing list