aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2021-03-06 15:22:25 +0000
committerAlan Mackenzie2021-03-06 15:22:25 +0000
commit1d43c1854a5cd8305200f6cff8ff8e80cb2b4b8a (patch)
tree372d9157f825641dac3eb6ab9ff46fecd3666e17
parentb8e3f338a67ca9c440f52ff2a6a9ac98dd5e0154 (diff)
downloademacs-1d43c1854a5cd8305200f6cff8ff8e80cb2b4b8a.tar.gz
emacs-1d43c1854a5cd8305200f6cff8ff8e80cb2b4b8a.zip
CC Mode: Fix calculation of c-parse-state when there're macros with braces
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.
-rw-r--r--lisp/progmodes/cc-engine.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 5a8b2f4f906..b7ad02cf0cd 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -3793,12 +3793,14 @@ mhtml-mode."
3793 (point))) 3793 (point)))
3794 (bra ; Position of "{". 3794 (bra ; Position of "{".
3795 ;; Don't start scanning in the middle of a CPP construct unless 3795 ;; Don't start scanning in the middle of a CPP construct unless
3796 ;; it contains HERE - these constructs, in Emacs, are "commented 3796 ;; it contains HERE.
3797 ;; out" with category properties. 3797 (if (and (not (eq macro-start-or-from from))
3798 (if (eq (c-get-char-property macro-start-or-from 'category) 3798 (< macro-start-or-from here) ; Might not be needed.
3799 'c-cpp-delimiter) 3799 (progn (goto-char macro-start-or-from)
3800 macro-start-or-from 3800 (c-end-of-macro)
3801 from)) 3801 (>= (point) here)))
3802 from
3803 macro-start-or-from))
3802 ce) ; Position of "}" 3804 ce) ; Position of "}"
3803 (or upper-lim (setq upper-lim from)) 3805 (or upper-lim (setq upper-lim from))
3804 3806