]> git.eshelyaron.com Git - emacs.git/commitdiff
CC Mode: Prevent ids in temporary "declarators" getting into c-found-types
authorAlan Mackenzie <acm@muc.de>
Mon, 16 Jan 2023 17:44:44 +0000 (17:44 +0000)
committerAlan Mackenzie <acm@muc.de>
Mon, 16 Jan 2023 17:44:44 +0000 (17:44 +0000)
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.

lisp/progmodes/cc-engine.el

index 8ac3ef6808d565e24316569fbefaad4e567035cb..45d90ea243141a5ce045ec3d9f267ac49efdf3d4 100644 (file)
@@ -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