This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

| In fact, it's even worse than just qD.

-- 
                                                        Gabriel Dos Reis
                                                         gdr@cs.tamu.edu
	 Texas A&M University -- Computer Science Department
	301, Bright Building -- College Station, TX 77843-3112


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]