]> git.eshelyaron.com Git - emacs.git/commitdiff
CC Mode: Recognise "struct foo {" as introducing a type declaration
authorAlan Mackenzie <acm@muc.de>
Wed, 1 Dec 2021 15:41:09 +0000 (15:41 +0000)
committerAlan Mackenzie <acm@muc.de>
Wed, 1 Dec 2021 15:41:09 +0000 (15:41 +0000)
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.

lisp/progmodes/cc-engine.el

index c42c95764a21603396f0566a0123e9fdd2de44c7..db1f46621dad4cb74ff8976559390d998c027121 100644 (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