emacs-diffs
[Top][All Lists]
Advanced

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

master b8134a7eba: CC Mode: Stabilize the fontification in the presence


From: Alan Mackenzie
Subject: master b8134a7eba: CC Mode: Stabilize the fontification in the presence of "register" keywords
Date: Tue, 8 Nov 2022 06:55:37 -0500 (EST)

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

    CC Mode: Stabilize the fontification in the presence of "register" keywords
    
    This fixes bug #58883.
    
    * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): New variable
    unsafe-maybe.  Set it in CASE 10 rather than setting 
c-record-type-identifiers
    to nil.  Near the end of the function, when unsafe-maybe is set, bind
    c-promote-possible-types to 'just-one rather than t around the call to
    c-forward-type.
---
 lisp/progmodes/cc-engine.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 8cf882d569..145f0cacd1 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -10208,7 +10208,11 @@ This function might do hidden buffer changes."
        (save-rec-ref-ids c-record-ref-identifiers)
        ;; Set when we parse a declaration which might also be an expression,
        ;; such as "a *b".  See CASE 16 and CASE 17.
-       maybe-expression)
+       maybe-expression
+       ;; Set for the type when `c-forward-type' returned `maybe', and we
+       ;; want to fontify it as a type, but aren't confident enough to enter
+       ;; it into `c-found-types'.
+       unsafe-maybe)
 
     (save-excursion
       (goto-char preceding-token-end)
@@ -10904,7 +10908,7 @@ This function might do hidden buffer changes."
           ;; a statement beginning with an identifier.
           (when (and (eq at-type 'maybe)
                      (not (eq context 'top)))
-            (setq c-record-type-identifiers nil))
+            (setq unsafe-maybe t))
           (throw 'at-decl-or-cast t))
 
         ;; CASE 11
@@ -11207,7 +11211,8 @@ This function might do hidden buffer changes."
                 ;; fontification just because it's "a known type that can't
                 ;; be a name or other expression".  2013-09-18.
                 )
-       (let ((c-promote-possible-types t))
+       (let ((c-promote-possible-types
+              (if unsafe-maybe 'just-one t)))
          (save-excursion
            (goto-char type-start)
            (c-forward-type))))



reply via email to

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