emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 c1d32d9a20: CC Mode: Prevent ids in temporary "declarators" get


From: Alan Mackenzie
Subject: emacs-29 c1d32d9a20: CC Mode: Prevent ids in temporary "declarators" getting into c-found-types
Date: Mon, 16 Jan 2023 12:46:54 -0500 (EST)

branch: emacs-29
commit c1d32d9a20dc94d403725c288d168451b916c034
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    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.
---
 lisp/progmodes/cc-engine.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 8ac3ef6808..45d90ea243 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]