mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
CC Mode: Fix fontification problems shown by test file templates-20.cc
Also fix one problem evident in test file decls-10.cc. * lisp/progmodes/cc-engine.el (c-brace-stack-at): Bind c-record-type-identifiers to nil to prevent called functions recording identifiers spuriously. (c-forward-<>-arglist-recur): Revert the ill-advised optimization from autumn 2022 which attempted to avoid re-marking c-type text properties inside angle bracket arglists. (c-forward-decl-or-cast-1): Accept the semicolon at the end of "t8 * id;" as sufficient evidence to fontify as a declaration (not a multiplication). * lisp/progmodes/cc-fonts.el (c-font-lock-c++-using): No longer fontify the last component of foo::bar with c-reference-face-name.
This commit is contained in:
parent
8678708ad1
commit
a42f4a775b
2 changed files with 12 additions and 16 deletions
|
|
@ -146,11 +146,6 @@
|
|||
;; "typedef" keyword. It's value is a list of the identifiers that
|
||||
;; the "typedef" declares as types.
|
||||
;;
|
||||
;; 'c-<>-c-types-set
|
||||
;; This property is set on an opening angle bracket, and indicates that
|
||||
;; any "," separators within the template/generic expression have been
|
||||
;; marked with a 'c-type property value 'c-<>-arg-sep (see above).
|
||||
;;
|
||||
;; 'c-awk-NL-prop
|
||||
;; Used in AWK mode to mark the various kinds of newlines. See
|
||||
;; cc-awk.el.
|
||||
|
|
@ -6172,12 +6167,18 @@ comment at the start of cc-engine.el for more info."
|
|||
(cons (point)
|
||||
(cons bound-<> s)))))
|
||||
|
||||
(defvar c-record-type-identifiers) ; Specially for `c-brace-stack-at'.
|
||||
|
||||
(defun c-brace-stack-at (here)
|
||||
;; Given a buffer position HERE, Return the value of the brace stack there.
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(let ((c c-bs-cache)
|
||||
(let (c-record-type-identifiers ; In case `c-forward-<>-arglist' would
|
||||
; otherwise record identifiers outside
|
||||
; of the restriction in force before
|
||||
; this function.
|
||||
(c c-bs-cache)
|
||||
(can-use-prev (<= c-bs-prev-pos c-bs-cache-limit))
|
||||
elt stack pos npos high-elt)
|
||||
;; Trim the cache to take account of buffer changes.
|
||||
|
|
@ -8630,11 +8631,9 @@ multi-line strings (but not C++, for example)."
|
|||
;; List that collects the positions after the argument
|
||||
;; separating ',' in the arglist.
|
||||
arg-start-pos)
|
||||
;; If the '<' has paren open syntax then we've marked it as an angle
|
||||
;; bracket arglist before, so skip to the end.
|
||||
(if (and syntax-table-prop-on-<
|
||||
(or (not c-parse-and-markup-<>-arglists)
|
||||
(c-get-char-property (point) 'c-<>-c-types-set)))
|
||||
(if (and (not c-parse-and-markup-<>-arglists)
|
||||
syntax-table-prop-on-<)
|
||||
|
||||
(progn
|
||||
(forward-char)
|
||||
(if (and (c-go-up-list-forward)
|
||||
|
|
@ -8731,7 +8730,6 @@ multi-line strings (but not C++, for example)."
|
|||
(c-unmark-<->-as-paren (point)))))
|
||||
(c-mark-<-as-paren start)
|
||||
(c-mark->-as-paren (1- (point)))
|
||||
(c-put-char-property start 'c-<>-c-types-set t)
|
||||
(c-truncate-lit-pos-cache start))
|
||||
(setq res t)
|
||||
nil)) ; Exit the loop.
|
||||
|
|
@ -11200,7 +11198,7 @@ This function might do hidden buffer changes."
|
|||
;; declaration.
|
||||
(setq maybe-expression t)
|
||||
(when (or (not c-asymmetry-fontification-flag)
|
||||
(looking-at "=[^=]")
|
||||
(looking-at "=\\([^=]\\|$\\)\\|;")
|
||||
(c-fdoc-assymetric-space-about-asterisk))
|
||||
(when (eq at-type 'maybe)
|
||||
(setq unsafe-maybe t))
|
||||
|
|
|
|||
|
|
@ -2678,9 +2678,7 @@ need for `c-font-lock-extra-types'.")
|
|||
'same)
|
||||
(looking-at c-colon-type-list-re)))
|
||||
;; Inherited protected member: leave unfontified
|
||||
)
|
||||
(t (goto-char pos)
|
||||
(c-font-lock-declarators limit nil c-label-face-name nil)))
|
||||
))
|
||||
(eq (char-after) ?,)))
|
||||
(forward-char))) ; over the comma.
|
||||
nil))
|
||||
|
|
|
|||
Loading…
Reference in a new issue