From: Alan Mackenzie Date: Mon, 16 Jan 2023 17:44:44 +0000 (+0000) Subject: CC Mode: Prevent ids in temporary "declarators" getting into c-found-types X-Git-Tag: emacs-29.0.90~705 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c1d32d9a20dc94d403725c288d168451b916c034;p=emacs.git CC Mode: Prevent ids in temporary "declarators" getting into c-found-types This should fix bug #60765. In the scenario type an identifier in front of foo (bar, baz), as when started a new statement. This temporarily makes the function call a declarator, and bar and baz types. Don't enter bar and baz into c-found-types. * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1) (CASE 6): When a 'maybe type triggers this case, set `unsafe-maybe' to non-nil. --- diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 8ac3ef6808d..45d90ea2431 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -10863,7 +10863,13 @@ This function might do hidden buffer changes." ;; types; other identifiers could just as well be ;; constants in C++. (memq at-type '(known found))))) - (throw 'at-decl-or-cast t) + (progn + ;; The user may be part way through typing a statement + ;; beginning with an identifier. This makes a 'maybe + ;; type in the following "declarator"'s arglist suspect. + (when (eq at-type 'maybe) + (setq unsafe-maybe t)) + (throw 'at-decl-or-cast t)) ;; CASE 7 ;; Can't be a valid declaration or cast, but if we've found a ;; specifier it can't be anything else either, so treat it as