GNU bug report logs - #35768
27.0.50; CC-Mode problems with function definitions with macro names

Previous Next

Packages: emacs, cc-mode;

Reported by: Mauro Aranda <maurooaranda <at> gmail.com>

Date: Thu, 16 May 2019 22:20:01 UTC

Severity: normal

Found in version 27.0.50

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Noam Postavsky <npostavs <at> gmail.com>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 35768 <at> debbugs.gnu.org
Subject: bug#35768: 27.0.50; CC-Mode problems with function definitions with macro names
Date: Thu, 16 May 2019 19:42:55 -0400
Mauro Aranda <maurooaranda <at> gmail.com> writes:

> I noticed CC-Mode sometimes doesn't identify correctly function names
> when a macro name is involved in the function definition.  Try the
> following recipe to see the problem:
>
> 1) emacs -Q
> 2) C-x C-f test.c
> 3) Type the following function definitions:
>
> int DUMMY
> foo (void)
> {
>   return 1;
> }
>
> DUMMY int
> bar (void)
> {
>   return 0;
> }
>
> 4) Observe that:
> a) foo doesn't get fontified with font-lock-function-name-face, but
> DUMMY does.  Consequently, C-c C-z inside foo echoes
> DUMMY as the function name, in the echo area.
> b) In bar, DUMMY gets font-lock-type-face, which I don't
> think is correct.  bar gets font-lock-function-name-face and C-c C-z
> works as expected.
>
> ---
>
> Other problem is with fontification of the return type in the following:
>
> bool DUMMY
> baz_t (void)
> {
>   return true;
> }
>
> bool
> baz_f (void)
> {
>   return false;
> }
>
> Observe that bool doesn't get fontified in baz_t, but DUMMY does.  When
> DUMMY is not present, bool gets fontified correctly (as in baz_f).
>
>
> If it helps, I found the problem in a source file with functions that
> have macros that declare some function attributes, like
> _GL_ATTRIBUTE_PURE.

Have you tried customizing c-noise-macro-names, as described in (ccmode) Noise Macros?




This bug report was last modified 6 years and 64 days ago.

Previous Next


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