aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Stjernholm2002-04-30 23:02:19 +0000
committerMartin Stjernholm2002-04-30 23:02:19 +0000
commitb3cf7e18a3ff9c36145faf1ba80c146ea7f14014 (patch)
tree4229e4ba009af2b8738228eec4b71b8e2ae546cc
parent397214d4a0b1566abb9ad85326f2c3ecf893afb9 (diff)
downloademacs-b3cf7e18a3ff9c36145faf1ba80c146ea7f14014.tar.gz
emacs-b3cf7e18a3ff9c36145faf1ba80c146ea7f14014.zip
(c-beginning-of-decl-1): Better way to handle protection labels, one
which doesn't get confused by inherit colons. (c-end-of-decl-1): Don't treat functions that have "class" or "struct" in the return type as classes or structs.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/progmodes/cc-engine.el40
2 files changed, 39 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b81ebc84d07..1608b0e6dd0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12002-05-01 Martin Stjernholm <bug-cc-mode@gnu.org>
2
3 * progmodes/cc-engine.el (c-beginning-of-decl-1): Better way
4 to handle protection labels, one which doesn't get confused by
5 inherit colons.
6
7 * progmodes/cc-engine.el (c-end-of-decl-1): Don't treat
8 functions that have "class" or "struct" in the return type as
9 classes or structs.
10
12002-04-30 Kim F. Storm <storm@cua.dk> 112002-04-30 Kim F. Storm <storm@cua.dk>
2 12
3 * menu-bar.el (menu-bar-custom-menu): Change "Recently Changed 13 * menu-bar.el (menu-bar-custom-menu): Change "Recently Changed
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 25346dad97e..fd5340f190d 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -1608,7 +1608,7 @@ brace."
1608 (catch 'return 1608 (catch 'return
1609 (let* ((start (point)) 1609 (let* ((start (point))
1610 (last-stmt-start (point)) 1610 (last-stmt-start (point))
1611 (move (c-beginning-of-statement-1 lim nil t))) 1611 (move (c-beginning-of-statement-1 lim t t)))
1612 1612
1613 (while (and (/= last-stmt-start (point)) 1613 (while (and (/= last-stmt-start (point))
1614 (save-excursion 1614 (save-excursion
@@ -1618,7 +1618,7 @@ brace."
1618 ;; want to continue if the block doesn't begin a top level 1618 ;; want to continue if the block doesn't begin a top level
1619 ;; construct, i.e. if it isn't preceded by ';', '}', ':', or bob. 1619 ;; construct, i.e. if it isn't preceded by ';', '}', ':', or bob.
1620 (setq last-stmt-start (point) 1620 (setq last-stmt-start (point)
1621 move (c-beginning-of-statement-1 lim nil t))) 1621 move (c-beginning-of-statement-1 lim t t)))
1622 1622
1623 (when c-recognize-knr-p 1623 (when c-recognize-knr-p
1624 (let ((fallback-pos (point)) knr-argdecl-start) 1624 (let ((fallback-pos (point)) knr-argdecl-start)
@@ -1634,7 +1634,7 @@ brace."
1634 (< knr-argdecl-start start) 1634 (< knr-argdecl-start start)
1635 (progn 1635 (progn
1636 (goto-char knr-argdecl-start) 1636 (goto-char knr-argdecl-start)
1637 (not (eq (c-beginning-of-statement-1 lim nil t) 'macro)))) 1637 (not (eq (c-beginning-of-statement-1 lim t t) 'macro))))
1638 (throw 'return 1638 (throw 'return
1639 (cons (if (eq (char-after fallback-pos) ?{) 1639 (cons (if (eq (char-after fallback-pos) ?{)
1640 'previous 1640 'previous
@@ -1642,6 +1642,17 @@ brace."
1642 knr-argdecl-start)) 1642 knr-argdecl-start))
1643 (goto-char fallback-pos)))) 1643 (goto-char fallback-pos))))
1644 1644
1645 (when c-opt-access-key
1646 ;; Might have ended up before a protection label. This should
1647 ;; perhaps be checked before `c-recognize-knr-p' to be really
1648 ;; accurate, but we know that no language has both.
1649 (while (looking-at c-opt-access-key)
1650 (goto-char (match-end 0))
1651 (c-forward-syntactic-ws)
1652 (when (>= (point) start)
1653 (goto-char start)
1654 (throw 'return (cons 'same nil)))))
1655
1645 ;; `c-beginning-of-statement-1' counts each brace block as a 1656 ;; `c-beginning-of-statement-1' counts each brace block as a
1646 ;; separate statement, so the result will be 'previous if we've 1657 ;; separate statement, so the result will be 'previous if we've
1647 ;; moved over any. If they were brace list initializers we might 1658 ;; moved over any. If they were brace list initializers we might
@@ -1700,13 +1711,19 @@ brace."
1700 (c-with-syntax-table decl-syntax-table 1711 (c-with-syntax-table decl-syntax-table
1701 (let ((lim (point))) 1712 (let ((lim (point)))
1702 (goto-char start) 1713 (goto-char start)
1703 (not (and (c-syntactic-re-search-forward 1714 (not (and
1704 (concat "[;=\(\[{]\\|\\<\\(" 1715 ;; Check for `c-opt-block-decls-with-vars-key'
1705 c-opt-block-decls-with-vars-key 1716 ;; before the first paren.
1706 "\\)") 1717 (c-syntactic-re-search-forward
1707 lim t 1 t) 1718 (concat "[;=\(\[{]\\|\\<\\("
1708 (match-beginning 1) 1719 c-opt-block-decls-with-vars-key
1709 (not (eq (char-before) ?_)))))))) 1720 "\\)")
1721 lim t 1 t)
1722 (match-beginning 1)
1723 (not (eq (char-before) ?_))
1724 ;; Check that the first following paren is the block.
1725 (c-syntactic-re-search-forward "[;=\(\[{]" lim t 1 t)
1726 (eq (char-before) ?{)))))))
1710 ;; The declaration doesn't have any of the 1727 ;; The declaration doesn't have any of the
1711 ;; `c-opt-block-decls-with-vars' keywords in the 1728 ;; `c-opt-block-decls-with-vars' keywords in the
1712 ;; beginning, so it ends here at the end of the block. 1729 ;; beginning, so it ends here at the end of the block.
@@ -3408,7 +3425,8 @@ Keywords are recognized and not considered identifiers."
3408 (setq lim (c-most-enclosing-brace c-state-cache (point))) 3425 (setq lim (c-most-enclosing-brace c-state-cache (point)))
3409 (c-beginning-of-statement-1 lim) 3426 (c-beginning-of-statement-1 lim)
3410 (c-add-stmt-syntax 'brace-list-close t lim 3427 (c-add-stmt-syntax 'brace-list-close t lim
3411 (c-whack-state-after (point) paren-state) t))) 3428 (c-whack-state-after (point) paren-state)
3429 t)))
3412 (t 3430 (t
3413 ;; Prepare for the rest of the cases below by going to the 3431 ;; Prepare for the rest of the cases below by going to the
3414 ;; token following the opening brace 3432 ;; token following the opening brace