emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-28 84166ea: CC Mode: Recognise "struct foo {" as introducing a typ


From: Alan Mackenzie
Subject: emacs-28 84166ea: CC Mode: Recognise "struct foo {" as introducing a type declaration
Date: Wed, 1 Dec 2021 10:43:32 -0500 (EST)

branch: emacs-28
commit 84166ea2e6a5c54fad1d31812eb6f3b3ca7374a1
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    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.
---
 lisp/progmodes/cc-engine.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index c42c957..db1f466 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]