Subject: bug#32403: 27.0.50; cc mode: c-display-defun-name doesn't work when return type is a pointer

From: Alan Mackenzie <[email-masked]>
Date: Sun, 26 Aug 2018 11:25:01 +0000

Hello, Mauro, hello, Eli.

On Fri, Aug 17, 2018 at 20:37:07 +0000, Alan Mackenzie wrote:
> On Fri, Aug 17, 2018 at 12:24:50 +0300, Eli Zaretskii wrote:
> > > From: Mauro Aranda <[email-masked]>
> > > Date: Wed, 8 Aug 2018 17:18:58 -0300

> > > Hello. I'm sending this report here because I tested in GNU Emacs 26.1.50 and the problem is not present. If
> > > it belongs to the CC Mode mailing list, please let me know.

> > > I run: emacs -Q and visit a C file.

> > > Inside a function that doesn't return a pointer, c-display-defun-name works just fine. Example:

> > > int
> > > dummy_returnint(int ret)
> > > {
> > >   return ret;
> > > }

> > > Minibuffer displays: dummy_returnint

> > > But when the function returns a pointer, c-display-defun-name fails to display the function name in the
> > > minibuffer. Example:

> > > int *
> > > dummy_returnpointertoint(int *ret)
> > > {
> > >   return ret;
> > > }

> > > Minibuffer displays nothing

> > Confirmed.  Alan, could you please take a look at this?

> Yes, certainly.  I've worked out a patch for Mauro's failure case (with
> the function's type being a pointer).

> Additionally, I've found a couple of edge cases which currently aren't
> working right:

>     struct foo bar = {0, 0};

> returns "struct foo" on C-c C-z.  It ought to return "bar";

>     struct foo {int a; int b} bar = {0, 0};

> also ought to return "bar".

> It shouldn't be too much work to fix these two, too.  I hope to have this
> done by tomorrow (European time) or, at the latest, on Sunday.

I've committed a fix for this to master.  It was a bit trickier than I'd
anticipated.

Mauro, would you please test the fix with your real source code and
either confirm to me that the problem has indeed been fixed, or tell me
where it's still failing.  Thanks!

-- 
Alan Mackenzie (Nuremberg, Germany).