summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-langs.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2018-03-28 19:39:30 +0000
committerAlan Mackenzie <acm@muc.de>2018-03-28 19:39:30 +0000
commitb61b3c804cb7c1348097ccef18d26fa4bdd37117 (patch)
treeea1418ebe8bb19941cddff694af29e9b40f22022 /lisp/progmodes/cc-langs.el
parent3ccbe1f43f8c73b5dbf7051b91cd850959f2a79f (diff)
downloademacs-b61b3c804cb7c1348097ccef18d26fa4bdd37117.tar.gz
Handle C++17's constexpr keyword in if statements
* lisp/progmodes/cc-engine.el (c-after-conditional): Test for matches to c-block-stmt-hangon-key. * lisp/progmodes/cc-langs.el (c-block-stmt-hangon-kwds): New lang const. (c-block-stmt-hangon-key): New lang const/var matching any element of the above.
Diffstat (limited to 'lisp/progmodes/cc-langs.el')
-rw-r--r--lisp/progmodes/cc-langs.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 98cfd2073d1..8fa253f3045 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -2587,6 +2587,17 @@ Keywords here should also be in `c-block-stmt-1-kwds'."
(c-lang-const c-block-stmt-2-kwds))
:test 'string-equal))
+(c-lang-defconst c-block-stmt-hangon-kwds
+ "Keywords which may directly follow a member of `c-block-stmt-1/2-kwds'."
+ t nil
+ c++ '("constexpr"))
+
+(c-lang-defconst c-block-stmt-hangon-key
+ ;; Regexp matching a "hangon" keyword in a `c-block-stmt-1/2-kwds'
+ ;; construct.
+ t (c-make-keywords-re t (c-lang-const c-block-stmt-hangon-kwds)))
+(c-lang-defvar c-block-stmt-hangon-key (c-lang-const c-block-stmt-hangon-key))
+
(c-lang-defconst c-opt-block-stmt-key
;; Regexp matching the start of any statement that has a
;; substatement (except a bare block). Nil in languages that