summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2021-12-01 15:41:09 +0000
committerAlan Mackenzie <acm@muc.de>2021-12-01 15:41:09 +0000
commit84166ea2e6a5c54fad1d31812eb6f3b3ca7374a1 (patch)
tree27f97f26d3c8317742431275eebee08d85f6b68d
parentbc6bcb8f0be9c472a381b07c1cfcb1d52f96ebd1 (diff)
downloademacs-84166ea2e6a5c54fad1d31812eb6f3b3ca7374a1.tar.gz
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.
-rw-r--r--lisp/progmodes/cc-engine.el7
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index c42c95764a2..db1f46621da 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -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