Skip to content

Commit

Permalink
progmodes/cc-langs.el: Support some of the new keywords in C++11.
Browse files Browse the repository at this point in the history
(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 <[email protected]> and updated
by Rüdiger Sonderfeld  <[email protected]>.
  • Loading branch information
doublep authored and ruediger committed Nov 18, 2014
1 parent 1901029 commit 0b37f90
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
11 changes: 11 additions & 0 deletions lisp/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
2014-11-18 Paul Pogonyshev <[email protected]>
Rüdiger Sonderfeld <[email protected]>

* 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 <[email protected]>

* textmodes/tildify.el (tildify-pattern, tildify-space-string):
Expand Down
15 changes: 10 additions & 5 deletions lisp/progmodes/cc-langs.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
'("->")))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -2384,8 +2386,11 @@ This construct is \"<keyword> <expression> :\"."
(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
Expand Down

0 comments on commit 0b37f90

Please sign in to comment.