]> git.eshelyaron.com Git - emacs.git/commitdiff
CC Mode: Fix calculation of c-parse-state when there're macros with braces
authorAlan Mackenzie <acm@muc.de>
Sat, 6 Mar 2021 15:22:25 +0000 (15:22 +0000)
committerAlan Mackenzie <acm@muc.de>
Sat, 6 Mar 2021 15:22:25 +0000 (15:22 +0000)
This fixes bug #46951.

* lisp/progmodes/cc-engine.el (c-append-lower-brace-pair-to-state-cache):
Ensure the starting point for backward scanning is not within a macro which
doesn't contain HERE.

lisp/progmodes/cc-engine.el

index 5a8b2f4f9060dab0325722fd91cc92cfbc8422f7..b7ad02cf0cd6b9ff65f691a9651fbf213f921095 100644 (file)
@@ -3793,12 +3793,14 @@ mhtml-mode."
                     (point)))
             (bra                       ; Position of "{".
              ;; Don't start scanning in the middle of a CPP construct unless
-             ;; it contains HERE - these constructs, in Emacs, are "commented
-             ;; out" with category properties.
-             (if (eq (c-get-char-property macro-start-or-from 'category)
-                       'c-cpp-delimiter)
-                   macro-start-or-from
-                 from))
+             ;; it contains HERE.
+             (if (and (not (eq macro-start-or-from from))
+                      (< macro-start-or-from here) ; Might not be needed.
+                      (progn (goto-char macro-start-or-from)
+                             (c-end-of-macro)
+                             (>= (point) here)))
+                 from
+               macro-start-or-from))
             ce)                        ; Position of "}"
        (or upper-lim (setq upper-lim from))