From: Alan Mackenzie Date: Fri, 13 Oct 2023 14:27:18 +0000 (+0000) Subject: Fix c-in-knr-argdecl to avoid false recognition of K&R X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=97959349651a8fb170c1c754e73a4d86ed24d018;p=emacs.git Fix c-in-knr-argdecl to avoid false recognition of K&R In the OP's test case, the type of a declaration was a macro with parentheses, which confused c-in-knr-argdecl. * lisp/progmodes/cc-engine.el (c-in-knr-argdecl): Amend this function to return nil if a "parameter declaration" can't be parsed as a declaration. --- diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index e687f44d657..f5e0d21108f 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -12266,11 +12266,14 @@ comment at the start of cc-engine.el for more info." ;; Each time around the following checks one ;; declaration (which may contain several identifiers). (while (and - (consp (setq decl-or-cast - (c-forward-decl-or-cast-1 - after-prec-token - nil ; Or 'arglist ??? - nil))) + (not (eq (char-after) ?{)) + (or + (consp (setq decl-or-cast + (c-forward-decl-or-cast-1 + after-prec-token + nil ; Or 'arglist ??? + nil))) + (throw 'knr nil)) (memq (char-after) '(?\; ?\,)) (goto-char (car decl-or-cast)) (save-excursion