1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 02:31:03 -08:00

CC Mode: Don't fontify as types variables with the same names as struct tags

This fixes bug #58534.

* lisp/progmodes/cc-engine.el (c-forward-type): Only regard "struct" keywords
which create self contained types (e.g. C++'s "typename") as creating found
types.

* lisp/progmodes/cc-langs.el (c-self-contained-typename-kwds
(c-self-contained-typename-key): New language consts and variable.
This commit is contained in:
Alan Mackenzie 2022-10-17 20:33:26 +00:00
parent 1e9341672d
commit c2b79d9148
2 changed files with 21 additions and 5 deletions

View file

@ -2294,11 +2294,22 @@ declaration with a type as a default value. This is used only in
C++ Mode, e.g. \"<typename X = Y>\"."
t nil
c++ '("class" "typename"))
(c-lang-defconst c-template-typename-key
t (c-make-keywords-re t (c-lang-const c-template-typename-kwds)))
(c-lang-defvar c-template-typename-key (c-lang-const c-template-typename-key))
(c-lang-defconst c-self-contained-typename-kwds
"Keywords where the following name is a type name which can be
used in declarations without the keyword."
t nil
c++ '("typename"))
(c-lang-defconst c-self-contained-typename-key
;; Adorned regexp matching `c-self-contained-typename-key'.
t (c-make-keywords-re t (c-lang-const c-self-contained-typename-kwds)))
(c-lang-defvar c-self-contained-typename-key
(c-lang-const c-self-contained-typename-key))
(c-lang-defconst c-type-prefix-kwds
"Keywords where the following name - if any - is a type name, and
where the keyword together with the symbol works as a type in