Subject: Re: bug#35768: 27.0.50; CC-Mode problems with function definitions with macro names

From: Noam Postavsky <[email-masked]>
Date: Thu, 16 May 2019 19:42:55 -0400

Mauro Aranda <[email-masked]> 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?