From 0b37f903b62b29726644dbad330d2a0bf91d85d6 Mon Sep 17 00:00:00 2001 From: Paul Pogonyshev Date: Tue, 18 Nov 2014 03:34:01 +0100 Subject: [PATCH] progmodes/cc-langs.el: Support some of the new keywords in C++11. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (c-operators): Add "alignof". (c-primitive-type-kwds): Add "char16_t", "char32_t". (c-type-modifier-kwds): Add "constexpr", "noexcept". (c-modifier-kwds): Add "thread_local". (c-constant-kwds): Add "nullptr". Original patch by Paul Pogonyshev and updated by RĂ¼diger Sonderfeld . --- lisp/ChangeLog | 11 +++++++++++ lisp/progmodes/cc-langs.el | 15 ++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0075c5a79caf..968ea8df0eff 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2014-11-18 Paul Pogonyshev + RĂ¼diger Sonderfeld + + * progmodes/cc-langs.el: Support some of the new keywords in + C++11. + (c-operators): Add "alignof". + (c-primitive-type-kwds): Add "char16_t", "char32_t". + (c-type-modifier-kwds): Add "constexpr", "noexcept". + (c-modifier-kwds): Add "thread_local". + (c-constant-kwds): Add "nullptr". + 2014-11-17 Michal Nazarewicz * textmodes/tildify.el (tildify-pattern, tildify-space-string): diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 2a5db6d3c866..68b2d6232c08 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -970,7 +970,8 @@ since CC Mode treats every identifier as an expression." ,@(when (c-major-mode-is 'c++-mode) ;; The following need special treatment. `((prefix "dynamic_cast" "static_cast" - "reinterpret_cast" "const_cast" "typeid"))) + "reinterpret_cast" "const_cast" "typeid" + "alignof"))) (left-assoc "." ,@(unless (c-major-mode-is 'java-mode) '("->"))) @@ -1648,7 +1649,7 @@ the appropriate place for that." '("_Bool" "_Complex" "_Imaginary") ; Conditionally defined in C99. (c-lang-const c-primitive-type-kwds)) c++ (append - '("bool" "wchar_t") + '("bool" "wchar_t" "char16_t" "char32_t") (c-lang-const c-primitive-type-kwds)) ;; Objective-C extends C, but probably not the new stuff in C99. objc (append @@ -1730,7 +1731,7 @@ but they don't build a type of themselves. Unlike the keywords on not the type face." t nil c '("const" "restrict" "volatile") - c++ '("const" "volatile" "throw") + c++ '("const" "constexpr" "noexcept" "volatile" "throw") objc '("const" "volatile")) (c-lang-defconst c-opt-type-modifier-key @@ -1932,7 +1933,8 @@ If any of these also are on `c-type-list-kwds', `c-ref-list-kwds', will be handled." t nil (c c++) '("auto" "extern" "inline" "register" "static") - c++ (append '("explicit" "friend" "mutable" "template" "using" "virtual") + c++ (append '("explicit" "friend" "mutable" "template" "thread_local" + "using" "virtual") (c-lang-const c-modifier-kwds)) objc '("auto" "bycopy" "byref" "extern" "in" "inout" "oneway" "out" "static") ;; FIXME: Some of those below ought to be on `c-other-decl-kwds' instead. @@ -2384,8 +2386,11 @@ This construct is \" :\"." (c-lang-defconst c-constant-kwds "Keywords for constants." t nil - (c c++) '("NULL" ;; Not a keyword, but practically works as one. + c '("NULL" ;; Not a keyword, but practically works as one. "false" "true") ; Defined in C99. + c++ (append + '("nullptr") + (c-lang-const c-constant-kwds)) objc '("nil" "Nil" "YES" "NO" "NS_DURING" "NS_HANDLER" "NS_ENDHANDLER") idl '("TRUE" "FALSE") java '("true" "false" "null") ; technically "literals", not keywords