[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#35768: 27.0.50; CC-Mode problems with function definitions with macr
From: |
Noam Postavsky |
Subject: |
bug#35768: 27.0.50; CC-Mode problems with function definitions with macro names |
Date: |
Thu, 16 May 2019 19:42:55 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
Mauro Aranda <maurooaranda@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?