From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 02 15:12:37 2022 Received: (at submit) by debbugs.gnu.org; 2 Jul 2022 19:12:37 +0000 Received: from localhost ([127.0.0.1]:42896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o7iXl-0001q4-2y for submit@debbugs.gnu.org; Sat, 02 Jul 2022 15:12:37 -0400 Received: from lists.gnu.org ([209.51.188.17]:39800) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o7iXj-0001pv-FL for submit@debbugs.gnu.org; Sat, 02 Jul 2022 15:12:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7iXj-0003me-B2 for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2022 15:12:35 -0400 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]:39680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o7iXh-0004Q6-Kk for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2022 15:12:35 -0400 Received: by mail-qk1-x72f.google.com with SMTP id b133so4120683qkc.6 for ; Sat, 02 Jul 2022 12:12:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Bvvwaqz52vMkCvpfWpINgQkvVZYjAKwoO4pMNsS7Lxs=; b=QOUiLq2C6PKlk1+4zubhxK3zdNY7onbaDW9xRWy1AW7RJOXOuzcnJTqd4lgeye+Ojk WInLG4VMB0XdYCES86HNOM8A0l7ER1M8MGBPvnagqCaQlSHF2eHIB9B7sr0YRoloAajQ HDBhdfTqJkF3DyTSKcBLrAz/5OUERGXV34KPJRQ5d/Y8xv/VtV1rgmUON/D9GYBfoMbo hx8VoEFUP3zLwBXeHVssVbSNs8zelL/5X0Zm3SESrWPt2KgP76cEVbutt+RLr70iPYX8 B85m6EnY6vUadKclDjPq8OVrFohv7praj2g2pr1VoUxli5VDxqSKHd1/o7yTrsF3LPJo 26yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Bvvwaqz52vMkCvpfWpINgQkvVZYjAKwoO4pMNsS7Lxs=; b=yHE9nZHsP03/RHqSHDTpPLbzNwxJag7jpD3aEwGLVEUuhYVSk+9x9UysYpU543PZWs sM8C0c6jG9OmMfYunKdm9gud3fxef2z0g5r1wjiyvDXwGu5aZA4feOUYh7X1ZscyNYzA MiElEDB0SloXOwYt4BOLtViAl1Ez8Jz1L1c88rs6XKwdTpg5JsG0ZPNTwtqZeAmVa0jY yXtuwoVmznRD7/ogTOA6XI6ukfJqpOY/QfHFreT8S6KGy3k/meMhViiRbuWjQSffC+WS 8CqMrMK2bkpSuFmhfgNvKnzCInVsIjD4Ad4Ie0BvonehKznrrvFU7jbJOvTwai6FEuyF PW/Q== X-Gm-Message-State: AJIora9T1mJ1MzFLXj/NIB0qYfiBhYc1Ykvoxkoen35WscShzeXOvT3P OLAHFtC87SQuE3Y9EKlZKyawsVsTAeQ= X-Google-Smtp-Source: AGRyM1vNoyApBMQ8hKlo3dXau3tksO4BbPGooxB5U/apvGFOuX93KGGtbMu3XLKnAxUSOoT4bdtUFg== X-Received: by 2002:a05:620a:461f:b0:6af:6f18:b429 with SMTP id br31-20020a05620a461f00b006af6f18b429mr14854619qkb.646.1656789151645; Sat, 02 Jul 2022 12:12:31 -0700 (PDT) Received: from Youmu (192.69.92.236.16clouds.com. [192.69.92.236]) by smtp.gmail.com with ESMTPSA id d3-20020a05620a240300b006af45243e15sm14872216qkn.114.2022.07.02.12.12.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Jul 2022 12:12:31 -0700 (PDT) From: Zhiwei Chen To: bug-gnu-emacs@gnu.org Subject: CC Mode 5.35.1 (C++//l); Highlight for C++20 keywords X-Debbugs-Package: cc-mode Date: Sun, 03 Jul 2022 03:12:28 +0800 Message-ID: <87o7y7z5ur.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::72f; envelope-from=condy0919@gmail.com; helo=mail-qk1-x72f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) Package: cc-mode See the comments. #+begin_src C++ #if __has_include() #include #endif #include #include // no highlight for consteval keyword consteval int sqr(int x) { return x * x; } // no highlight for constinit keyword constinit int four =3D sqr(16); class Foo { public: // <=3D> highlights wrong auto operator<=3D>(const Foo&) const =3D default; private: // no highlight for alignas keyword alignas(alignof(std::uint64_t)) int val_; }; template requires std::integral // 'requires' occasionally has a font-lock-type-f= ace T add(T a, T b) { return a + b; } int main() { const char8_t c1 =3D 0; // char8_t is missing in `c-primitive-type-kwds= '. cc-langs.el L2205 return 0; } #+end_src Emacs : GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24= .34, cairo version 1.17.6) of 2022-07-02 Package: CC Mode 5.35.1 (C++//l) Buffer Style: gnu c-emacs-features: (pps-extended-state col-0-paren posix-char-classes gen-st= ring-delim gen-comment-delim syntax-properties 1-bit) current state: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (setq c-basic-offset 4 c-comment-only-line-offset '(0 . 0) c-indent-comment-alist '((anchored-comment column . 0) (end-block space . = 1) (cpp-end-block space . 2)) c-indent-comments-syntactically-p nil c-block-comment-prefix "" c-comment-prefix-regexp '((c-mode . "//+!?\\|\\**") (c++-mode . "//+!?\\|\= \**") (awk-mode . "#+") (other . "//+\\|\\**")) c-doc-comment-style '((c-mode . gtkdoc) (c++-mode . doxygen)) c-cleanup-list '(scope-operator) c-hanging-braces-alist '((substatement-open before after) (arglist-cont-no= nempty)) c-hanging-colons-alist nil c-hanging-semi&comma-criteria '(c-semi&comma-inside-parenlist) c-backslash-column 48 c-backslash-max-column 72 c-special-indent-hook '(t c-gnu-impose-minimum) c-label-minimum-indentation 0 c-offsets-alist '((inexpr-class . +) (incomposition . +) (inmodule . +) (composition-close . 0) (module-close . 0) (composition-open . 0) (module-open . 0) (objc-method-call-cont c-lineup-ObjC-method-call-colons c-lineup-ObjC-method-call + ) (objc-method-args-cont . c-lineup-ObjC-method-args) (objc-method-intro . [0]) (cpp-define-intro c-lineup-cpp-define +) (annotation-var-cont . +) (annotation-top-cont . 0) (knr-argdecl . 0) (knr-argdecl-intro . 5) (c . c-lineup-C-comments) (string . c-lineup-dont-change) (defun-open . 0) (defun-close . 0) (defun-block-intro . +) (class-open . 0) (class-close . 0) (access-label . -) (inline-open . 0) (inline-close . 0) (inclass . +) (friend . 0) (func-decl-cont . +) (brace-list-open . 0) (brace-list-close . 0) (brace-list-intro . +) (brace-list-entry . 0) (brace-entry-open . 0) (namespace-open . 0) (namespace-close . 0) (innamespace . 0) (block-open . 0) (block-close . 0) (topmost-intro . 0) (topmost-intro-cont . c-lineup-topmost-intro-cont) (member-init-intro . +) (member-init-cont . c-lineup-multi-inher) (inher-intro . +) (inher-cont . c-lineup-multi-inher) (statement . 0) (statement-cont c-lineup-ternary-bodies +) (statement-block-intro . +) (statement-case-intro . +) (statement-case-open . +) (substatement . +) (substatement-open . 0) (substatement-label . 0) (case-label . 0) (label . 0) (do-while-closure . 0) (else-clause . 0) (catch-clause . 0) (comment-intro . c-lineup-comment) (arglist-intro . +) (arglist-cont . 0) (arglist-cont-nonempty . c-lineup-arglist) (arglist-close . c-lineup-close-paren) (stream-op . c-lineup-streamop) (cpp-macro . -1000) (cpp-macro-cont . +) (extern-lang-open . 0) (extern-lang-close . 0) (inextern-lang . 0) (inlambda . 0) (lambda-intro-cont . +) (inexpr-statement . 0) (template-args-cont c-lineup-template-args +) ) c-buffer-is-cc-mode 'c++-mode c-tab-always-indent t c-syntactic-indentation t c-syntactic-indentation-in-macros t c-ignore-auto-fill '(string cpp code) c-auto-align-backslashes t c-backspace-function 'backward-delete-char-untabify c-delete-function 'delete-char c-electric-pound-behavior nil c-default-style '((java-mode . "java") (awk-mode . "awk") (other . "gnu")) c-enable-xemacs-performance-kludge-p nil c-old-style-variable-behavior nil defun-prompt-regexp nil tab-width 4 comment-column 32 parse-sexp-ignore-comments t parse-sexp-lookup-properties t auto-fill-function nil comment-multi-line t comment-start-skip "\\(?://+\\|/\\*+\\)\\s *" fill-prefix nil fill-column 80 paragraph-start "[ ]*\\(//+!?\\|\\**\\)[ ]*$\\|^\f" adaptive-fill-mode t adaptive-fill-regexp "[ ]*\\(//+!?\\|\\**\\)[ ]*\\([ ]*\\([-=E2=80=93!|= #%;>*=C2=B7=E2=80=A2=E2=80=A3=E2=81=83=E2=97=A6]+[ ]*\\)*\\)" ) --=20 Zhiwei Chen From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 07 09:01:33 2022 Received: (at 56362) by debbugs.gnu.org; 7 Sep 2022 13:01:33 +0000 Received: from localhost ([127.0.0.1]:53991 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oVugP-0005AZ-80 for submit@debbugs.gnu.org; Wed, 07 Sep 2022 09:01:33 -0400 Received: from mx3.muc.de ([193.149.48.5]:23529) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oVugN-0005AI-Bx for 56362@debbugs.gnu.org; Wed, 07 Sep 2022 09:01:32 -0400 Received: (qmail 21363 invoked by uid 3782); 7 Sep 2022 15:01:25 +0200 Received: from acm.muc.de (p4fe15ce5.dip0.t-ipconnect.de [79.225.92.229]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 07 Sep 2022 15:01:24 +0200 Received: (qmail 6287 invoked by uid 1000); 7 Sep 2022 13:01:24 -0000 Date: Wed, 7 Sep 2022 13:01:24 +0000 To: Zhiwei Chen Subject: Re: bug#56362: CC Mode 5.35.1 (C++//l); Highlight for C++20 keywords Message-ID: References: <87o7y7z5ur.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87o7y7z5ur.fsf@gmail.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 56362 Cc: acm@muc.de, 56362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Zhiwei. First of all, sorry that it's taken me two months to reply. Secondly, thanks for taking the trouble to submit this bug. I have fixed the problems, partly, but I still have a lot of work to do to bring CC Mode up to the C++20 standard. In particular, "concepts" and "requires" will need a lot doing. I hope to do this work in the coming weeks. I have included a patch for these problems below; could you please test this patch on your CC Mode and your real C++ source files, and let me know how it goes. As I said, it is not perfect, but it should be better than it was. If you want any help with the patching or byte compiling of CC Mode, feel free to send me private email. For the problems you raised: On Sun, Jul 03, 2022 at 03:12:28 +0800, Zhiwei Chen wrote: > Package: cc-mode > See the comments. > #+begin_src C++ > #if __has_include() > #include > #endif > #include > #include > // no highlight for consteval keyword > consteval int sqr(int x) { > return x * x; > } Now fixed. > // no highlight for constinit keyword > constinit int four = sqr(16); Now fixed. > class Foo { > public: > // <=> highlights wrong > auto operator<=>(const Foo&) const = default; Now fixed. > private: > // no highlight for alignas keyword > alignas(alignof(std::uint64_t)) int val_; > }; Now fixed. It's also worth noting that "alignas" in a struct/class: class alignas(64) Foo { ..... } should now fontify correctly. > template > requires std::integral // 'requires' occasionally has a font-lock-type-face > T add(T a, T b) { > return a + b; > } Here's where I still need to make "requires" work properly. I've temporarily make "requires" and "concept" C++ keywords, but in the above piece of code, "T add(T a, T b) {" is not correctly fontified. But "requires" should now always be fontified as a keyword. > int main() { > const char8_t c1 = 0; // char8_t is missing in `c-primitive-type-kwds'. cc-langs.el L2205 > return 0; > } > #+end_src char8_t is now in c-primitive-type-kwds. > Emacs : GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6) > of 2022-07-02 > Package: CC Mode 5.35.1 (C++//l) > Buffer Style: gnu > c-emacs-features: (pps-extended-state col-0-paren posix-char-classes gen-string-delim gen-comment-delim syntax-properties 1-bit) [ CC Mode configuration appreciated, but snipped ] Here's the patch: diff -r 87af98f62eec cc-langs.el --- a/cc-langs.el Wed Aug 31 18:28:12 2022 +0000 +++ b/cc-langs.el Wed Sep 07 12:38:20 2022 +0000 @@ -1301,6 +1301,10 @@ ,@(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) @@ -1414,7 +1418,7 @@ "^" "??'" "xor" "&" "bitand" "|" "??!" "bitor" "~" "??-" "compl" "!" "=" "<" ">" "+=" "-=" "*=" "/=" "%=" "^=" "??'=" "xor_eq" "&=" "and_eq" "|=" "??!=" "or_eq" - "<<" ">>" ">>=" "<<=" "==" "!=" "not_eq" "<=" ">=" + "<<" ">>" ">>=" "<<=" "==" "!=" "not_eq" "<=>" "<=" ">=" "&&" "and" "||" "??!??!" "or" "++" "--" "," "->*" "->" "()" "[]" "<::>" "??(??)") ;; These work like identifiers in Pike. @@ -1535,8 +1539,10 @@ "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) + '("<=>")) "<" ">" "<=" ">=" "==" "!=" "&" "^" "|" @@ -2187,7 +2193,7 @@ '("_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 @@ -2580,8 +2586,8 @@ t nil (c c++) '("extern" "inline" "register" "static") c (append '("auto") (c-lang-const c-modifier-kwds)) - c++ (append '("constexpr" "explicit" "friend" "mutable" "template" - "thread_local" "virtual") + c++ (append '("consteval" "constexpr" "constinit" "explicit" "friend" + "mutable" "template" "thread_local" "virtual") ;; "using" is now handled specially (2020-09-14). (c-lang-const c-modifier-kwds)) objc '("auto" "bycopy" "byref" "extern" "in" "inout" "oneway" "out" "static") @@ -2655,7 +2661,8 @@ (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'. @@ -2880,7 +2887,7 @@ "__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))) @@ -3256,11 +3263,17 @@ (c-lang-defconst c-keywords ;; All keywords as a list. t (c--delete-duplicates - (c-lang-defconst-eval-immediately - `(append ,@(mapcar (lambda (kwds-lang-const) - `(c-lang-const ,kwds-lang-const)) - c-kwds-lang-consts) - nil)) + (append ; Temporary, 2022-09-07 + (c-lang-defconst-eval-immediately + `(append ,@(mapcar (lambda (kwds-lang-const) + `(c-lang-const ,kwds-lang-const)) + c-kwds-lang-consts) + nil)) + ;; Temporary addition for C++ until concepts have been worked out properly. + ;; 2022-09-07. + `(,@(if (c-major-mode-is 'c++-mode) + '("concept" "requires"))) + nil) :test 'string-equal)) (c-lang-defconst c-keywords-regexp -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 04 13:32:50 2022 Received: (at 56362-done) by debbugs.gnu.org; 4 Oct 2022 17:32:50 +0000 Received: from localhost ([127.0.0.1]:55106 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oflmk-0004lN-Ba for submit@debbugs.gnu.org; Tue, 04 Oct 2022 13:32:50 -0400 Received: from mx3.muc.de ([193.149.48.5]:31965) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oflmi-0004l9-76 for 56362-done@debbugs.gnu.org; Tue, 04 Oct 2022 13:32:49 -0400 Received: (qmail 33020 invoked by uid 3782); 4 Oct 2022 19:32:41 +0200 Received: from acm.muc.de (p4fe158d6.dip0.t-ipconnect.de [79.225.88.214]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 04 Oct 2022 19:32:41 +0200 Received: (qmail 15599 invoked by uid 1000); 4 Oct 2022 17:32:40 -0000 Date: Tue, 4 Oct 2022 17:32:40 +0000 To: Zhiwei Chen Subject: Re: bug#56362: CC Mode 5.35.1 (C++//l); Highlight for C++20 keywords Message-ID: References: <87o7y7z5ur.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 56362-done Cc: 56362-done@debbugs.gnu.org, acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello again, Zhiwei. I've now committed the changes to standalone CC Mode and the Emacs master branch. As a matter of interest, I've also committed support for C++20 concepts and modules. I'm closing the bug with this post. -- Alan Mackenzie (Nuremberg, Germany). On Wed, Sep 07, 2022 at 13:01:24 +0000, Alan Mackenzie wrote: > Hello, Zhiwei. > First of all, sorry that it's taken me two months to reply. > Secondly, thanks for taking the trouble to submit this bug. I have fixed > the problems, partly, but I still have a lot of work to do to bring CC > Mode up to the C++20 standard. In particular, "concepts" and "requires" > will need a lot doing. I hope to do this work in the coming weeks. > I have included a patch for these problems below; could you please test > this patch on your CC Mode and your real C++ source files, and let me > know how it goes. As I said, it is not perfect, but it should be better > than it was. If you want any help with the patching or byte compiling of > CC Mode, feel free to send me private email. > For the problems you raised: > On Sun, Jul 03, 2022 at 03:12:28 +0800, Zhiwei Chen wrote: > > Package: cc-mode > > See the comments. > > #+begin_src C++ > > #if __has_include() > > #include > > #endif > > #include > > #include > > // no highlight for consteval keyword > > consteval int sqr(int x) { > > return x * x; > > } > Now fixed. > > // no highlight for constinit keyword > > constinit int four = sqr(16); > Now fixed. > > class Foo { > > public: > > // <=> highlights wrong > > auto operator<=>(const Foo&) const = default; > Now fixed. > > private: > > // no highlight for alignas keyword > > alignas(alignof(std::uint64_t)) int val_; > > }; > Now fixed. It's also worth noting that "alignas" in a struct/class: > class alignas(64) Foo { ..... } > should now fontify correctly. > > template > > requires std::integral // 'requires' occasionally has a font-lock-type-face > > T add(T a, T b) { > > return a + b; > > } > Here's where I still need to make "requires" work properly. I've > temporarily make "requires" and "concept" C++ keywords, but in the above > piece of code, "T add(T a, T b) {" is not correctly fontified. But > "requires" should now always be fontified as a keyword. > > int main() { > > const char8_t c1 = 0; // char8_t is missing in `c-primitive-type-kwds'. cc-langs.el L2205 > > return 0; > > } > > #+end_src > char8_t is now in c-primitive-type-kwds. > > Emacs : GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6) > > of 2022-07-02 > > Package: CC Mode 5.35.1 (C++//l) > > Buffer Style: gnu > > c-emacs-features: (pps-extended-state col-0-paren posix-char-classes gen-string-delim gen-comment-delim syntax-properties 1-bit) > [ CC Mode configuration appreciated, but snipped ] > Here's the patch: > diff -r 87af98f62eec cc-langs.el > --- a/cc-langs.el Wed Aug 31 18:28:12 2022 +0000 > +++ b/cc-langs.el Wed Sep 07 12:38:20 2022 +0000 > @@ -1301,6 +1301,10 @@ > ,@(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) > @@ -1414,7 +1418,7 @@ > "^" "??'" "xor" "&" "bitand" "|" "??!" "bitor" "~" "??-" "compl" > "!" "=" "<" ">" "+=" "-=" "*=" "/=" "%=" "^=" > "??'=" "xor_eq" "&=" "and_eq" "|=" "??!=" "or_eq" > - "<<" ">>" ">>=" "<<=" "==" "!=" "not_eq" "<=" ">=" > + "<<" ">>" ">>=" "<<=" "==" "!=" "not_eq" "<=>" "<=" ">=" > "&&" "and" "||" "??!??!" "or" "++" "--" "," "->*" "->" > "()" "[]" "<::>" "??(??)") > ;; These work like identifiers in Pike. > @@ -1535,8 +1539,10 @@ > "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) > + '("<=>")) > "<" ">" "<=" ">=" > "==" "!=" > "&" "^" "|" > @@ -2187,7 +2193,7 @@ > '("_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 > @@ -2580,8 +2586,8 @@ > t nil > (c c++) '("extern" "inline" "register" "static") > c (append '("auto") (c-lang-const c-modifier-kwds)) > - c++ (append '("constexpr" "explicit" "friend" "mutable" "template" > - "thread_local" "virtual") > + c++ (append '("consteval" "constexpr" "constinit" "explicit" "friend" > + "mutable" "template" "thread_local" "virtual") > ;; "using" is now handled specially (2020-09-14). > (c-lang-const c-modifier-kwds)) > objc '("auto" "bycopy" "byref" "extern" "in" "inout" "oneway" "out" "static") > @@ -2655,7 +2661,8 @@ > (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'. > @@ -2880,7 +2887,7 @@ > "__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))) > @@ -3256,11 +3263,17 @@ > (c-lang-defconst c-keywords > ;; All keywords as a list. > t (c--delete-duplicates > - (c-lang-defconst-eval-immediately > - `(append ,@(mapcar (lambda (kwds-lang-const) > - `(c-lang-const ,kwds-lang-const)) > - c-kwds-lang-consts) > - nil)) > + (append ; Temporary, 2022-09-07 > + (c-lang-defconst-eval-immediately > + `(append ,@(mapcar (lambda (kwds-lang-const) > + `(c-lang-const ,kwds-lang-const)) > + c-kwds-lang-consts) > + nil)) > + ;; Temporary addition for C++ until concepts have been worked out properly. > + ;; 2022-09-07. > + `(,@(if (c-major-mode-is 'c++-mode) > + '("concept" "requires"))) > + nil) > :test 'string-equal)) > (c-lang-defconst c-keywords-regexp > -- > Alan Mackenzie (Nuremberg, Germany). From unknown Sat Sep 06 01:11:50 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 02 Nov 2022 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator