Subject: bug#61135: CC Mode 5.35.2 (C/*l); Incorrect fontification of function call

From: Alan Mackenzie <[email-masked]>
Date: Mon, 30 Jan 2023 20:23:45 +0000

Hello, Po.

On Sun, Jan 29, 2023 at 13:55:50 +0800, Po Lu via CC-Mode-help wrote:
> Package: cc-mode

> Insert the following text in a C Mode buffer:

> static const char *
> sfnt_interpret_font_program (struct sfnt_interpreter *interpreter,
> 			     struct sfnt_font_program *fpgm)
> {
>   if (setjmp (interpreter->trap))
>     return interpreter->trap_reason;

>   /* Set up the interpreter to evaluate the font program.  */
>   interpreter->PC = 0;
>   interpreter->SP = interpreter->stack;
>   interpreter->instructions = fpgm->instructions;
>   interpreter->num_instructions = fpgm->num_instructions;

>   sfnt_interpret_run (interpreter, SFNT_RUN_CONTEXT_FONT_PROGRAM);
> }

> `sfnt_interpret_run' will be fontified in font-lock-function-name-face,
> which is not how CC Mode usually works.  Thanks.

This bug was triggered by the string "struct" in fpgm->inSTRUCTions and
fpgm->num_inSTRUCTions.  It would also have been triggered by either of
"union" or "extern".  There was a regexp which was lacking a "\\>"
element for "match end of word".  ("\\_>" is unavailable on XEmacs.).

I've fixed the macro which generates that regexp and committed the
change to the release branch.  Would you please update your Emacs, and
confirm that the bug has indeed been fixed.  Thanks!

> Emacs  : GNU Emacs 30.0.50 (build 41, x86_64-pc-linux-gnu)
>  of 2023-01-29
> Package: CC Mode 5.35.2 (C/*l)
> Buffer Style: gnu
> c-emacs-features: (pps-extended-state col-0-paren posix-char-classes gen-string-delim gen-comment-delim syntax-properties category-properties 1-bit)

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).