mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-22 04:47:34 +00:00
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.
This commit is contained in:
parent
68e2a9cd92
commit
b8134a7eba
1 changed files with 8 additions and 3 deletions
|
|
@ -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))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue