emacs-diffs
[Top][All Lists]
Advanced

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

master 7e493b1773: CC Mode: Prevent over-eager recognition of a variable


From: Alan Mackenzie
Subject: master 7e493b1773: CC Mode: Prevent over-eager recognition of a variable as a found type
Date: Mon, 14 Nov 2022 04:49:31 -0500 (EST)

branch: master
commit 7e493b1773b8e7c5762af4e6f21dadec649ce4dc
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    CC Mode: Prevent over-eager recognition of a variable as a found type
    
    This fixes bug #59233.  It occurred in the C source code fragment
    
        open_replies = alloca (nproviders )
    
    , where typing a * before the closing parenthesis caused nproviders to be
    prematurely recognized as a type.
    
    * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): CASE 18 - set
    unsafe-maybe to t, when needed.
---
 lisp/progmodes/cc-engine.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 5d3d240886..9139699b5b 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -11079,6 +11079,11 @@ This function might do hidden buffer changes."
             ;; `got-parens' or `got-suffix' is set it's "a()", "a[]", "a()[]",
             ;; or similar, which we accept only if the context rules out
             ;; expressions.
+            ;;
+            ;; If we've got at-type 'maybe, we cannot confidently promote the
+            ;; possible type to a found type.
+            (when (and (eq at-type 'maybe))
+              (setq unsafe-maybe t))
             (throw 'at-decl-or-cast t)))
 
         ;; If we had a complete symbol table here (which rules out



reply via email to

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