emacs-diffs
[Top][All Lists]
Advanced

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

master e579c9cc33d: CC Mode: Miscellaneous coding fixes in c-forward-typ


From: Alan Mackenzie
Subject: master e579c9cc33d: CC Mode: Miscellaneous coding fixes in c-forward-type
Date: Thu, 6 Apr 2023 05:17:40 -0400 (EDT)

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

    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.
---
 lisp/progmodes/cc-engine.el | 13 ++++++++++---
 1 file 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.



reply via email to

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