Subject: Re: bug#25623: CC Mode 5.32.99 (C/l); `c-defun-name' returns wrong result for filescope enums, structs and unions

From: Mohammed Sadiq <[email-masked]>
Date: Mon, 24 Apr 2017 00:00:07 +0530 (IST)

Hi,

> On April 23, 2017 at 5:48 PM Alan Mackenzie <[email-masked]> wrote:
> Thanks for the bug report.  This bug is simply a matter of buggy code in
> CC Mode.  There follows a patch.
> 
> Would you please apply this patch, compile cc-cmds.el, try it out, then
> either confirm to me that the bug is fixed, or tell me what still needs
> looking at.  Thanks in advance!
> [code snipped]

Hi. I have a few test cases that this fails (not quiet bad, but may be better not 
to break)

enum
  {
   A,
   B,|
   C,
  };

gives 'nil', which would better return 'enum' as it is common to have enums without
names associated.

int a[] = {'h', 'e', 'l', 'l', 'o', '\0'|};

gives "[" which I believe, should actually return 'nil' when defined at file scope.

typedef struct
{
  int a;
  int b;|
} nice;

returns "nice". It may be better to return "struct nice" as in "struct nice {...};" definition.

Thanks
 
> Alan Mackenzie (Nuremberg, Germany).