Subject: bug#54743: CC Mode 5.35.1 (C/*l); Incorrect fontification of function call as function name

From: Alan Mackenzie <[email-masked]>
Date: Sun, 10 Apr 2022 10:38:10 +0000

Hello again, Po.

On Wed, Apr 06, 2022 at 10:05:36 +0800, Po Lu via CC-Mode-help wrote:
> Package: cc-mode

> Open src/haikumenu.c in the Emacs source code, and go to line 352.  The
> calls to `process_pending_signals' and `internal_catch_all' are
> fontified as function names, which is wrong.

> Thanks.

> Emacs  : GNU Emacs 29.0.50 (build 1, x86_64-unknown-haiku, Haiku R1/beta3, cairo version 1.16.0)
>  of 2022-04-06
> Package: CC Mode 5.35.1 (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 1-bit)

It looks like the bug was a "simple" mistyping.  I think the following
patch, which is literally a 1-bit change, should fix the problem.  Would
you please try it out, and confirm to me that it does indeed fix the
problem.  Thanks!

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index ebc1ef4301..b2fa9e0691 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -6139,7 +6139,7 @@ c-update-brace-stack
 	  (setq s (cons -1 (cdr s))))
 	 ((and (equal match ",")
 	       (eq (car s) -1)))	; at "," in "class foo : bar, ..."
-	 ((member match '(";" "*" "," "("))
+	 ((member match '(";" "*" "," ")"))
 	  (when (and s (cdr s) (<= (car s) 0))
 	    (setq s (cdr s))))
 	 ((c-keyword-member kwd-sym 'c-flat-decl-block-kwds)

-- 
Alan Mackenzie (Nuremberg, Germany).