summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-langs.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2017-12-13 20:55:03 +0000
committerAlan Mackenzie <acm@muc.de>2017-12-13 20:55:03 +0000
commit4cb8696e4754d815efd5fd5e26f2b6b2567a11fe (patch)
tree7272c661d7d1cd25d00deb9d1209a99507903dcb /lisp/progmodes/cc-langs.el
parentce31e726adbb4d24557b3d1ff067cc4c04d94446 (diff)
downloademacs-4cb8696e4754d815efd5fd5e26f2b6b2567a11fe.tar.gz
Don't misfontify "foo ()" inside C++ initialization parentheses as a type
Also recognize and handle function names introduced by "extern" inside a function. * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): Add a new element to the result list which is t when our declaration is, or is to be treated as, being at top level. * lisp/progmodes/cc-fonts.el (c-get-fontification-context): Detect being inside a C++ uniform initialization and return (not-decl nil) for this case. (c-font-lock-declarations): Use the new element 4 of the result of c-forward-decl-or-cast-1. * lisp/progmodes/cc-langs.el (c-make-top-level-kwds, c-make-top-level-key): New lang consts/vars.
Diffstat (limited to 'lisp/progmodes/cc-langs.el')
-rw-r--r--lisp/progmodes/cc-langs.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 227b3e16485..869048bee31 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -2355,6 +2355,16 @@ construct it's part of continues."
t nil
(c c++ objc) '("extern"))
+(c-lang-defconst c-make-top-level-kwds
+ "Keywords which make declarations they introduce be handled as top-level."
+ t nil
+ (c c++ objc) '("extern"))
+
+(c-lang-defconst c-make-top-level-key
+ ;; A regexp which matches any `c-make-top-level-kwds' keyword.
+ t (c-make-keywords-re t (c-lang-const c-make-top-level-kwds)))
+(c-lang-defvar c-make-top-level-key (c-lang-const c-make-top-level-key))
+
(c-lang-defconst c-type-list-kwds
"Keywords that may be followed by a comma separated list of type
identifiers, where each optionally can be prefixed by keywords. (Can