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

Previous Next

Package: cc-mode;

Reported by: Mohammed Sadiq <sadiq <at> sadiqpk.org>

Date: Sun, 5 Feb 2017 02:52:02 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 25623 <at> debbugs.gnu.org (full text, mbox):

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 25623 <at> debbugs.gnu.org
Subject: Re: bug#25623: CC Mode 5.32.99 (C/l); `c-defun-name' returns wrong
 result for filescope enums, structs and unions
Date: Mon, 24 Apr 2017 00:00:07 +0530 (IST)
Hi,

> On April 23, 2017 at 5:48 PM Alan Mackenzie <acm <at> muc.de> 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).




This bug report was last modified 8 years and 31 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.