emacs-diffs
[Top][All Lists]
Advanced

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

master 5fa0fcf18b: CC Mode: Improve accuracy of recognition of bitfields


From: Alan Mackenzie
Subject: master 5fa0fcf18b: CC Mode: Improve accuracy of recognition of bitfields
Date: Tue, 8 Nov 2022 09:57:44 -0500 (EST)

branch: master
commit 5fa0fcf18bb23f3a6f028a1478644b7027b02d8c
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    CC Mode: Improve accuracy of recognition of bitfields
    
    * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): When we've got two
    identifiers followed by a colon, additionally check for a number (or
    identifier) followed by a semicolon or comma before concluding we have a
    bitfield.
---
 lisp/progmodes/cc-engine.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 145f0cacd1..a13a0c838a 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -10773,7 +10773,15 @@ This function might do hidden buffer changes."
                        ((eq at-decl-or-cast t)
                         (throw 'at-decl-or-cast t))
                        ((and c-has-bitfields
-                             (eq at-decl-or-cast 'ids)) ; bitfield.
+                             ;; Check for a bitfield.
+                             (eq at-decl-or-cast 'ids)
+                             (save-excursion
+                               (forward-char) ; Over the :
+                               (c-forward-syntactic-ws)
+                               (and (looking-at "[[:alnum:]]")
+                                    (progn (c-forward-token-2)
+                                           (c-forward-syntactic-ws)
+                                           (memq (char-after) '(?\; ?,))))))
                         (setq backup-if-not-cast t)
                         (throw 'at-decl-or-cast t)))
 



reply via email to

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