diff options
author | Alan Mackenzie <acm@muc.de> | 2022-10-04 17:13:56 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2022-10-04 17:19:33 +0000 |
commit | 91071765115d3458a1deba56be5b247622eddf73 (patch) | |
tree | e08896af97746ee6f3cd2b9db4618ebf74ef9093 /lisp/progmodes/cc-langs.el | |
parent | bf9d3ddac07e961d0a35414d0f64399966537d80 (diff) | |
download | emacs-91071765115d3458a1deba56be5b247622eddf73.tar.gz |
CC Mode: A new operator and some new keywords for C++20
* lisp/progmodes/cc-langs.el (c-operators, c-overloadable-operators)
(c-arithmetic-operators): Add the "spaceship" operator for C++.
(c-primitive-type-kwds): Add char8_t for C++.
(c-decl-hangon-kwds, c-paren-nontype-kwds): Add alignas for C++.
Diffstat (limited to 'lisp/progmodes/cc-langs.el')
-rw-r--r-- | lisp/progmodes/cc-langs.el | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 3b008fd6dc7..cd23483a58f 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -1330,6 +1330,10 @@ since CC Mode treats every identifier as an expression." ,@(when (c-major-mode-is 'java-mode) '(">>>"))) + ;; The C++ "spaceship" operator. + ,@(when (c-major-mode-is 'c++-mode) + `((left-assoc "<=>"))) + ;; Relational. (left-assoc "<" ">" "<=" ">=" ,@(when (c-major-mode-is 'java-mode) @@ -1443,7 +1447,7 @@ form\". See also `c-op-identifier-prefix'." "^" "??'" "xor" "&" "bitand" "|" "??!" "bitor" "~" "??-" "compl" "!" "=" "<" ">" "+=" "-=" "*=" "/=" "%=" "^=" "??'=" "xor_eq" "&=" "and_eq" "|=" "??!=" "or_eq" - "<<" ">>" ">>=" "<<=" "==" "!=" "not_eq" "<=" ">=" + "<<" ">>" ">>=" "<<=" "==" "!=" "not_eq" "<=>" "<=" ">=" "&&" "and" "||" "??!??!" "or" "++" "--" "," "->*" "->" "()" "[]" "<::>" "??(??)") ;; These work like identifiers in Pike. @@ -1565,8 +1569,10 @@ operators." "List of all arithmetic operators, including \"+=\", etc." ;; Note: in the following, there are too many operators for AWK and IDL. t (append (c-lang-const c-assignment-operators) - '("+" "-" "*" "/" "%" + `("+" "-" "*" "/" "%" "<<" ">>" + ,@(if (c-major-mode-is 'c++-mode) + '("<=>")) "<" ">" "<=" ">=" "==" "!=" "&" "^" "|" @@ -2216,7 +2222,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" "char16_t" "char32_t") + '("bool" "wchar_t" "char8_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 @@ -2713,7 +2719,8 @@ one of `c-type-list-kwds', `c-ref-list-kwds', (c c++) '(;; GCC extension. "__attribute__" ;; MSVC extension. - "__declspec")) + "__declspec") + c++ (append (c-lang-const c-decl-hangon-kwds) '("alignas"))) (c-lang-defconst c-decl-hangon-key ;; Adorned regexp matching `c-decl-hangon-kwds'. @@ -2937,7 +2944,7 @@ contain type identifiers." "__attribute__" ;; MSVC extension. "__declspec") - c++ (append (c-lang-const c-paren-nontype-kwds) '("noexcept"))) + c++ (append (c-lang-const c-paren-nontype-kwds) '("noexcept" "alignas"))) (c-lang-defconst c-paren-nontype-key t (c-make-keywords-re t (c-lang-const c-paren-nontype-kwds))) |