1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/commits/948df39cfb8a/
Changeset: 948df39cfb8a
User: acm
Date: 2018-03-28 19:28:44+00:00
Summary: Handle C++17's constexpr keyword in if statements
* cc-engine.el (c-after-conditional): Test for matches to
c-block-stmt-hangon-key.
* 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.
Affected #: 2 files
diff -r bb8af6c225af -r 948df39cfb8a cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -9856,9 +9856,15 @@
;; This function might do hidden buffer changes.
(save-excursion
(and (zerop (c-backward-token-2 1 t lim))
+ (if (looking-at c-block-stmt-hangon-key)
+ (zerop (c-backward-token-2 1 t lim))
+ t)
(or (looking-at c-block-stmt-1-key)
(and (eq (char-after) ?\()
(zerop (c-backward-token-2 1 t lim))
+ (if (looking-at c-block-stmt-hangon-key)
+ (zerop (c-backward-token-2 1 t lim))
+ t)
(or (looking-at c-block-stmt-2-key)
(looking-at c-block-stmt-1-2-key))))
(point))))
diff -r bb8af6c225af -r 948df39cfb8a cc-langs.el
--- a/cc-langs.el
+++ b/cc-langs.el
@@ -2568,6 +2568,17 @@
(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
Repository URL:
https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from
bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.