aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2013-10-19 15:11:07 +0000
committerAlan Mackenzie2013-10-19 15:11:07 +0000
commit033f22ddadf6c11b4d35108f3c299692bb3bbc60 (patch)
tree30720b2a9f090a33972c681db7026c37f13d277e
parent8d02f0ad3ba4cb4863f99579454c29e55149ffd9 (diff)
downloademacs-033f22ddadf6c11b4d35108f3c299692bb3bbc60.tar.gz
emacs-033f22ddadf6c11b4d35108f3c299692bb3bbc60.zip
Fix fontification bugs with constructors and const.
* progmodes/cc-engine.el (c-forward-decl-or-cast-1): (Just after CASE 2) Remove the check for the absence of a suffix construct after a function declaration with only types (no identifiers) in the parentheses. Also, accept a function declaration with just a type inside the parentheses, if this type can be positively recognised as such, or if a prefix keyword like "explicit" nails down the construct as a declaration.
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/progmodes/cc-engine.el48
2 files changed, 41 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 883b5d7b21e..402ef8062a1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12013-10-19 Alan Mackenzie <acm@muc.de>
2
3 Fix fontification bugs with constructors and const.
4
5 * progmodes/cc-engine.el (c-forward-decl-or-cast-1): (Just after
6 CASE 2) Remove the check for the absence of a suffix construct
7 after a function declaration with only types (no identifiers) in
8 the parentheses. Also, accept a function declaration with just a
9 type inside the parentheses, if this type can be positively
10 recognised as such, or if a prefix keyword like "explicit" nails
11 down the construct as a declaration.
12
12013-10-19 Eli Zaretskii <eliz@gnu.org> 132013-10-19 Eli Zaretskii <eliz@gnu.org>
2 14
3 * menu-bar.el (tty-menu-navigation-map): Bind mouse-N to perform 15 * menu-bar.el (tty-menu-navigation-map): Bind mouse-N to perform
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index d624d1eaed2..0d25e1355e7 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -6917,7 +6917,9 @@ comment at the start of cc-engine.el for more info."
6917 ;; can happen since we don't know if 6917 ;; can happen since we don't know if
6918 ;; `c-restricted-<>-arglists' will be correct inside the 6918 ;; `c-restricted-<>-arglists' will be correct inside the
6919 ;; arglist paren that gets entered. 6919 ;; arglist paren that gets entered.
6920 c-parse-and-markup-<>-arglists) 6920 c-parse-and-markup-<>-arglists
6921 ;; Start of the identifier for which `got-identifier' was set.
6922 name-start)
6921 6923
6922 (goto-char id-start) 6924 (goto-char id-start)
6923 6925
@@ -6935,7 +6937,9 @@ comment at the start of cc-engine.el for more info."
6935 ;; If the third submatch matches in C++ then 6937 ;; If the third submatch matches in C++ then
6936 ;; we're looking at an identifier that's a 6938 ;; we're looking at an identifier that's a
6937 ;; prefix only if it specifies a member pointer. 6939 ;; prefix only if it specifies a member pointer.
6938 (when (setq got-identifier (c-forward-name)) 6940 (when (progn (setq pos (point))
6941 (setq got-identifier (c-forward-name)))
6942 (setq name-start pos)
6939 (if (looking-at "\\(::\\)") 6943 (if (looking-at "\\(::\\)")
6940 ;; We only check for a trailing "::" and 6944 ;; We only check for a trailing "::" and
6941 ;; let the "*" that should follow be 6945 ;; let the "*" that should follow be
@@ -6961,7 +6965,9 @@ comment at the start of cc-engine.el for more info."
6961 ;; Skip over an identifier. 6965 ;; Skip over an identifier.
6962 (or got-identifier 6966 (or got-identifier
6963 (and (looking-at c-identifier-start) 6967 (and (looking-at c-identifier-start)
6964 (setq got-identifier (c-forward-name)))) 6968 (setq pos (point))
6969 (setq got-identifier (c-forward-name))
6970 (setq name-start pos)))
6965 6971
6966 ;; Skip over type decl suffix operators. 6972 ;; Skip over type decl suffix operators.
6967 (while (if (looking-at c-type-decl-suffix-key) 6973 (while (if (looking-at c-type-decl-suffix-key)
@@ -7052,23 +7058,27 @@ comment at the start of cc-engine.el for more info."
7052 ;; declaration. 7058 ;; declaration.
7053 (throw 'at-decl-or-cast t)) 7059 (throw 'at-decl-or-cast t))
7054 7060
7055 (when (and got-parens
7056 (not got-prefix)
7057 (not got-suffix-after-parens)
7058 (or backup-at-type
7059 maybe-typeless
7060 backup-maybe-typeless))
7061 ;; Got a declaration of the form "foo bar (gnu);" where we've
7062 ;; recognized "bar" as the type and "gnu" as the declarator.
7063 ;; In this case it's however more likely that "bar" is the
7064 ;; declarator and "gnu" a function argument or initializer (if
7065 ;; `c-recognize-paren-inits' is set), since the parens around
7066 ;; "gnu" would be superfluous if it's a declarator. Shift the
7067 ;; type one step backward.
7068 (c-fdoc-shift-type-backward)))
7069
7070 ;; Found no identifier.
7071 7061
7062 (when (and got-parens
7063 (not got-prefix)
7064 ;; (not got-suffix-after-parens)
7065 (or backup-at-type
7066 maybe-typeless
7067 backup-maybe-typeless
7068 (eq at-decl-or-cast t)
7069 (save-excursion
7070 (goto-char name-start)
7071 (not (memq (c-forward-type) '(nil maybe))))))
7072 ;; Got a declaration of the form "foo bar (gnu);" or "bar
7073 ;; (gnu);" where we've recognized "bar" as the type and "gnu"
7074 ;; as the declarator. In this case it's however more likely
7075 ;; that "bar" is the declarator and "gnu" a function argument
7076 ;; or initializer (if `c-recognize-paren-inits' is set),
7077 ;; since the parens around "gnu" would be superfluous if it's
7078 ;; a declarator. Shift the type one step backward.
7079 (c-fdoc-shift-type-backward)))
7080
7081 ;; Found no identifier.
7072 (if backup-at-type 7082 (if backup-at-type
7073 (progn 7083 (progn
7074 7084