diff options
| author | Alan Mackenzie | 2023-04-06 09:14:56 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2023-04-06 09:14:56 +0000 |
| commit | e579c9cc33df536cbd29c2db3960fb30bb7d75c6 (patch) | |
| tree | 7d8db1f1d1e3427ed020a09aa3a055359e48de7a | |
| parent | d6ac2627466fc193cc95bb84c59b3f23e9d5b6fa (diff) | |
| download | emacs-e579c9cc33df536cbd29c2db3960fb30bb7d75c6.tar.gz emacs-e579c9cc33df536cbd29c2db3960fb30bb7d75c6.zip | |
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.
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 13 |
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)." | |||
| 9120 | (c-forward-syntactic-ws)) | 9120 | (c-forward-syntactic-ws)) |
| 9121 | 9121 | ||
| 9122 | (let ((start (point)) pos res name-res id-start id-end id-range | 9122 | (let ((start (point)) pos res name-res id-start id-end id-range |
| 9123 | post-prefix-pos) | 9123 | post-prefix-pos prefix-end-pos) |
| 9124 | 9124 | ||
| 9125 | ;; Skip leading type modifiers. If any are found we know it's a | 9125 | ;; Skip leading type modifiers. If any are found we know it's a |
| 9126 | ;; prefix of a type. | 9126 | ;; prefix of a type. |
| @@ -9130,6 +9130,7 @@ multi-line strings (but not C++, for example)." | |||
| 9130 | (when (looking-at c-no-type-key) | 9130 | (when (looking-at c-no-type-key) |
| 9131 | (setq res 'no-id))) | 9131 | (setq res 'no-id))) |
| 9132 | (goto-char (match-end 1)) | 9132 | (goto-char (match-end 1)) |
| 9133 | (setq prefix-end-pos (point)) | ||
| 9133 | (setq pos (point)) | 9134 | (setq pos (point)) |
| 9134 | (c-forward-syntactic-ws) | 9135 | (c-forward-syntactic-ws) |
| 9135 | (or (eq res 'no-id) | 9136 | (or (eq res 'no-id) |
| @@ -9281,7 +9282,10 @@ multi-line strings (but not C++, for example)." | |||
| 9281 | (not (looking-at c-type-decl-prefix-key))))) | 9282 | (not (looking-at c-type-decl-prefix-key))))) |
| 9282 | ;; A C specifier followed by an implicit int, e.g. | 9283 | ;; A C specifier followed by an implicit int, e.g. |
| 9283 | ;; "register count;" | 9284 | ;; "register count;" |
| 9284 | (goto-char id-start) | 9285 | (goto-char prefix-end-pos) |
| 9286 | (setq pos (point)) | ||
| 9287 | (unless stop-at-end | ||
| 9288 | (c-forward-syntactic-ws)) | ||
| 9285 | (setq res 'no-id)) | 9289 | (setq res 'no-id)) |
| 9286 | 9290 | ||
| 9287 | (name-res | 9291 | (name-res |
| @@ -9289,6 +9293,7 @@ multi-line strings (but not C++, for example)." | |||
| 9289 | ;; A normal identifier. | 9293 | ;; A normal identifier. |
| 9290 | (goto-char id-end) | 9294 | (goto-char id-end) |
| 9291 | (setq pos (point)) | 9295 | (setq pos (point)) |
| 9296 | (c-forward-syntactic-ws) | ||
| 9292 | (if (or res c-promote-possible-types) | 9297 | (if (or res c-promote-possible-types) |
| 9293 | (progn | 9298 | (progn |
| 9294 | (when (not (eq c-promote-possible-types 'just-one)) | 9299 | (when (not (eq c-promote-possible-types 'just-one)) |
| @@ -9296,7 +9301,9 @@ multi-line strings (but not C++, for example)." | |||
| 9296 | (when (and c-record-type-identifiers id-range) | 9301 | (when (and c-record-type-identifiers id-range) |
| 9297 | (c-record-type-id id-range)) | 9302 | (c-record-type-id id-range)) |
| 9298 | (unless res | 9303 | (unless res |
| 9299 | (setq res 'found))) | 9304 | (setq res 'found)) |
| 9305 | (when (eq res 'prefix) | ||
| 9306 | (setq res t))) | ||
| 9300 | (setq res (if (c-check-qualified-type id-start) | 9307 | (setq res (if (c-check-qualified-type id-start) |
| 9301 | ;; It's an identifier that has been used as | 9308 | ;; It's an identifier that has been used as |
| 9302 | ;; a type somewhere else. | 9309 | ;; a type somewhere else. |