summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2023-04-06 09:14:56 +0000
committerAlan Mackenzie <acm@muc.de>2023-04-06 09:14:56 +0000
commite579c9cc33df536cbd29c2db3960fb30bb7d75c6 (patch)
tree7d8db1f1d1e3427ed020a09aa3a055359e48de7a /lisp/progmodes
parentd6ac2627466fc193cc95bb84c59b3f23e9d5b6fa (diff)
downloademacs-e579c9cc33df536cbd29c2db3960fb30bb7d75c6.tar.gz
CC Mode: Miscellaneous coding fixes in c-forward-type
This fixes bug #62339. * lisp/progmodes/cc-engine.el (c-forward-type): In the implicit int handling, respect the setting of the parameter stop-at-end. In the case "normal identifier", insert a missing (c-forward-syntactic-ws); this fixes the bug. Here, correct the wrong return value `prefix' to t.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/cc-engine.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index fe9e62ee569..4045576630c 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -9120,7 +9120,7 @@ multi-line strings (but not C++, for example)."
(c-forward-syntactic-ws))
(let ((start (point)) pos res name-res id-start id-end id-range
- post-prefix-pos)
+ post-prefix-pos prefix-end-pos)
;; Skip leading type modifiers. If any are found we know it's a
;; prefix of a type.
@@ -9130,6 +9130,7 @@ multi-line strings (but not C++, for example)."
(when (looking-at c-no-type-key)
(setq res 'no-id)))
(goto-char (match-end 1))
+ (setq prefix-end-pos (point))
(setq pos (point))
(c-forward-syntactic-ws)
(or (eq res 'no-id)
@@ -9281,7 +9282,10 @@ multi-line strings (but not C++, for example)."
(not (looking-at c-type-decl-prefix-key)))))
;; A C specifier followed by an implicit int, e.g.
;; "register count;"
- (goto-char id-start)
+ (goto-char prefix-end-pos)
+ (setq pos (point))
+ (unless stop-at-end
+ (c-forward-syntactic-ws))
(setq res 'no-id))
(name-res
@@ -9289,6 +9293,7 @@ multi-line strings (but not C++, for example)."
;; A normal identifier.
(goto-char id-end)
(setq pos (point))
+ (c-forward-syntactic-ws)
(if (or res c-promote-possible-types)
(progn
(when (not (eq c-promote-possible-types 'just-one))
@@ -9296,7 +9301,9 @@ multi-line strings (but not C++, for example)."
(when (and c-record-type-identifiers id-range)
(c-record-type-id id-range))
(unless res
- (setq res 'found)))
+ (setq res 'found))
+ (when (eq res 'prefix)
+ (setq res t)))
(setq res (if (c-check-qualified-type id-start)
;; It's an identifier that has been used as
;; a type somewhere else.