CC Mode: Recognise "struct foo {" as introducing a type declaration

This fixes bug #52157.

* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): If such a construct
is parsed, set the flag at-type-decl which is part of the function's return
value.
This commit is contained in:
Alan Mackenzie 2021-12-01 15:41:09 +00:00
parent bc6bcb8f0b
commit 84166ea2e6

View file

@ -9978,7 +9978,12 @@ This function might do hidden buffer changes."
(save-excursion
(goto-char type-start)
(let ((c-promote-possible-types t))
(c-forward-type)))))
(c-forward-type))))
;; Signal a type declaration for "struct foo {".
(when (and backup-at-type-decl
(eq (char-after) ?{))
(setq at-type-decl t)))
(setq backup-at-type at-type
backup-type-start type-start