summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-langs.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2020-09-04 19:10:17 +0000
committerAlan Mackenzie <acm@muc.de>2020-09-04 19:10:17 +0000
commit793871310599f8c75cf86bed97bdad70577cc5dd (patch)
tree0fee5b0ac36b9573d70606d28cacb3aba724424b /lisp/progmodes/cc-langs.el
parent2b95300cf8e3da9f505233f116cabe39a3564fa7 (diff)
downloademacs-793871310599f8c75cf86bed97bdad70577cc5dd.tar.gz
emacs-793871310599f8c75cf86bed97bdad70577cc5dd.tar.bz2
emacs-793871310599f8c75cf86bed97bdad70577cc5dd.zip
C++ Mode: handle comma separated brace initializers.
This includes both indentation and fontification. * lisp/progmodes/cc-engine.el (c-do-declarators): Handle brace initializers without = correctly. (c-looking-at-or-maybe-in-bracelist): Use c-do-declarators with a simple inline function to check that after-type-id-pos points to the start of a declarator. * lisp/progmodes/cc-langs.el (c-recognize-bare-brace-inits): New lang const/variable.
Diffstat (limited to 'lisp/progmodes/cc-langs.el')
-rw-r--r--lisp/progmodes/cc-langs.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index e7e7cfd4b09..0a7f4565c0e 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -3684,6 +3684,20 @@ Foo bar = gnu;"
c++ t)
(c-lang-defvar c-recognize-paren-inits (c-lang-const c-recognize-paren-inits))
+(c-lang-defconst c-recognize-bare-brace-inits
+ "Non-nil means that brace initializers without \"=\" exist,
+i.e. constructs like
+
+int foo[] {1, 2, 3};
+
+in addition to the more classic
+
+int foo[] = {1, 2, 3};"
+ t nil
+ c++ t)
+(c-lang-defvar c-recognize-bare-brace-inits
+ (c-lang-const c-recognize-bare-brace-inits))
+
(c-lang-defconst c-recognize-paren-inexpr-blocks
"Non-nil to recognize gcc style in-expression blocks,
i.e. compound statements surrounded by parentheses inside expressions."