* bug#51092: [PATCH] Recognize consteval and constinit modifiers in C++ @ 2021-10-08 1:10 Evan Klitzke 2021-10-08 11:02 ` Lars Ingebrigtsen 0 siblings, 1 reply; 8+ messages in thread From: Evan Klitzke @ 2021-10-08 1:10 UTC (permalink / raw) To: 51092 [-- Attachment #1: Type: text/plain, Size: 389 bytes --] These two modifiers were introduced by C++20. The change is trivial but I tested it locally on some code I have that uses these modifiers and with this change the keywords are recognized as expected. I agree to copyright assignment to the FSF, etc. Patch against master is attached; I think this should be backported to the emacs-28 branch as well. -- evan klitzke https://eklitzke.org/ [-- Attachment #2: consteval.patch --] [-- Type: text/x-patch, Size: 966 bytes --] commit 968bc01aee341d76748480701764b2fba0689112 (HEAD -> consteval, evan/consteval) Author: Evan Klitzke <evan@eklitzke.org> Date: Thu Oct 7 17:47:25 2021 -0700 Add consteval and constinit keywords (introduced in C++20) diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 53f6206a82..8e68f044e8 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -2590,8 +2590,8 @@ c-modifier-kwds 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") ^ permalink raw reply related [flat|nested] 8+ messages in thread
* bug#51092: [PATCH] Recognize consteval and constinit modifiers in C++ 2021-10-08 1:10 bug#51092: [PATCH] Recognize consteval and constinit modifiers in C++ Evan Klitzke @ 2021-10-08 11:02 ` Lars Ingebrigtsen 2021-10-12 10:54 ` Alan Mackenzie 0 siblings, 1 reply; 8+ messages in thread From: Lars Ingebrigtsen @ 2021-10-08 11:02 UTC (permalink / raw) To: Evan Klitzke; +Cc: 51092, Alan Mackenzie Evan Klitzke <evan@eklitzke.org> writes: > These two modifiers were introduced by C++20. The change is trivial > but I tested it locally on some code I have that uses these modifiers > and with this change the keywords are recognized as expected. I agree > to copyright assignment to the FSF, etc. Patch against master is > attached; I think this should be backported to the emacs-28 branch as > well. [...] > - c++ (append '("constexpr" "explicit" "friend" "mutable" "template" > - "thread_local" "virtual") > + c++ (append '("consteval" "constexpr" "constinit" "explicit" > + "friend" "mutable" "template" "thread_local" "virtual") Makes sense to me; perhaps Alan has some comments, so I've added him to the CCs. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#51092: [PATCH] Recognize consteval and constinit modifiers in C++ 2021-10-08 11:02 ` Lars Ingebrigtsen @ 2021-10-12 10:54 ` Alan Mackenzie 2021-10-12 14:13 ` Eli Zaretskii ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Alan Mackenzie @ 2021-10-12 10:54 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: 51092, acm, Evan Klitzke Hello, Evan and Lars. On Fri, Oct 08, 2021 at 13:02:02 +0200, Lars Ingebrigtsen wrote: > Evan Klitzke <evan@eklitzke.org> writes: > > These two modifiers were introduced by C++20. The change is trivial > > but I tested it locally on some code I have that uses these modifiers > > and with this change the keywords are recognized as expected. I agree > > to copyright assignment to the FSF, etc. Patch against master is > > attached; I think this should be backported to the emacs-28 branch as > > well. > [...] > > - c++ (append '("constexpr" "explicit" "friend" "mutable" "template" > > - "thread_local" "virtual") > > + c++ (append '("consteval" "constexpr" "constinit" "explicit" > > + "friend" "mutable" "template" "thread_local" "virtual") > Makes sense to me; perhaps Alan has some comments, so I've added him to > the CCs. As the maintainer of CC Mode, i'm in two minds over this. It's clearly a step in the right direction. But there's a non-trivial amount of work to be done to implement C++20's new features, and having just those few new keywords and nothing else in the release branch might jar. Evan, you've clearly burrowed a fair way into CC Mode, and have some idea of how complicated it is. Do you perhaps feel able and willing to add a larger part of C++20's new feature set to CC Mode? Regular discussion and help from me would, of course, be available. I envisage starting off in the CC Mode standalone project, and transferring the new features steadily to the Emacs master branch as they become ready; this has been my standard way of working for many years. The standalone project is at SourceForge, and uses Mercurial (which is easy to learn) rather than git. The copyright assignments are a bit of a hassle. I think they've still got to be done on paper. But for just the patch you've proposed, an assignment wouldn't be needed. Richard Stallman has confirmed that the measure is the number of lines of code added/changed, not the degree of functionality. Lars is probably better informed than me about this, and Eli Zaretskii certainly is. > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#51092: [PATCH] Recognize consteval and constinit modifiers in C++ 2021-10-12 10:54 ` Alan Mackenzie @ 2021-10-12 14:13 ` Eli Zaretskii 2021-10-14 18:22 ` Evan Klitzke 2022-09-10 5:19 ` Lars Ingebrigtsen 2 siblings, 0 replies; 8+ messages in thread From: Eli Zaretskii @ 2021-10-12 14:13 UTC (permalink / raw) To: Alan Mackenzie; +Cc: 51092, acm, larsi, evan > Date: Tue, 12 Oct 2021 10:54:00 +0000 > From: Alan Mackenzie <acm@muc.de> > Cc: 51092@debbugs.gnu.org, acm@muc.de, Evan Klitzke <evan@eklitzke.org> > > The copyright assignments are a bit of a hassle. I think they've still > got to be done on paper. No, not anymore. ^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#51092: [PATCH] Recognize consteval and constinit modifiers in C++ 2021-10-12 10:54 ` Alan Mackenzie 2021-10-12 14:13 ` Eli Zaretskii @ 2021-10-14 18:22 ` Evan Klitzke 2022-09-10 5:19 ` Lars Ingebrigtsen 2 siblings, 0 replies; 8+ messages in thread From: Evan Klitzke @ 2021-10-14 18:22 UTC (permalink / raw) To: Alan Mackenzie; +Cc: 51092, Lars Ingebrigtsen On Tue, Oct 12, 2021 at 6:54 AM Alan Mackenzie <acm@muc.de> wrote: > As the maintainer of CC Mode, i'm in two minds over this. It's clearly > a step in the right direction. But there's a non-trivial amount of work > to be done to implement C++20's new features, and having just those few > new keywords and nothing else in the release branch might jar. It doesn't necessarily have to be in the release branch, I just thought it would be nice since it's such a small change. But I'm not too familiar with the branching process of Emacs or how much work that is. > Evan, you've clearly burrowed a fair way into CC Mode, and have some > idea of how complicated it is. Do you perhaps feel able and willing to > add a larger part of C++20's new feature set to CC Mode? Regular > discussion and help from me would, of course, be available. I envisage > starting off in the CC Mode standalone project, and transferring the new > features steadily to the Emacs master branch as they become ready; this > has been my standard way of working for many years. The standalone > project is at SourceForge, and uses Mercurial (which is easy to learn) > rather than git. I'm far from an expert at elisp but I'm happy to review and test changes to cc mode, and discuss them. I did look through some other parts of the cc mode code and it is pretty daunting. I don't mind working with sourceforge or mercurial. I'm curious, do you have an idea of what other C++20 features need more support in cc mode? One thing I did notice when making this change is that some modifiers in C++ should only apply to variable declarations (e.g. mutable, thread_local, constinit), some apply only to function declarations (e.g. virtual, consteval), and some can apply to either (e.g. constexpr), and currently the cc mode code doesn't distinguish between these cases. But this isn't exactly a C++20 thing, since it applies to many of the existing keywords. -- evan klitzke https://eklitzke.org/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#51092: [PATCH] Recognize consteval and constinit modifiers in C++ 2021-10-12 10:54 ` Alan Mackenzie 2021-10-12 14:13 ` Eli Zaretskii 2021-10-14 18:22 ` Evan Klitzke @ 2022-09-10 5:19 ` Lars Ingebrigtsen 2022-09-13 17:26 ` Alan Mackenzie 2 siblings, 1 reply; 8+ messages in thread From: Lars Ingebrigtsen @ 2022-09-10 5:19 UTC (permalink / raw) To: Alan Mackenzie; +Cc: 51092, Evan Klitzke Alan Mackenzie <acm@muc.de> writes: >> > - c++ (append '("constexpr" "explicit" "friend" "mutable" "template" >> > - "thread_local" "virtual") >> > + c++ (append '("consteval" "constexpr" "constinit" "explicit" >> > + "friend" "mutable" "template" "thread_local" "virtual") > >> Makes sense to me; perhaps Alan has some comments, so I've added him to >> the CCs. > > As the maintainer of CC Mode, i'm in two minds over this. It's clearly > a step in the right direction. But there's a non-trivial amount of work > to be done to implement C++20's new features, and having just those few > new keywords and nothing else in the release branch might jar. There wasn't much followup here. Alan, isn't the proposed patch a step in the right direction anyway, even if it doesn't add full C++20 support? ^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#51092: [PATCH] Recognize consteval and constinit modifiers in C++ 2022-09-10 5:19 ` Lars Ingebrigtsen @ 2022-09-13 17:26 ` Alan Mackenzie 2022-09-14 12:32 ` Lars Ingebrigtsen 0 siblings, 1 reply; 8+ messages in thread From: Alan Mackenzie @ 2022-09-13 17:26 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: 51092, acm, Evan Klitzke Hello, Lars and Evan. On Sat, Sep 10, 2022 at 07:19:04 +0200, Lars Ingebrigtsen wrote: > Alan Mackenzie <acm@muc.de> writes: > >> > - c++ (append '("constexpr" "explicit" "friend" "mutable" "template" > >> > - "thread_local" "virtual") > >> > + c++ (append '("consteval" "constexpr" "constinit" "explicit" > >> > + "friend" "mutable" "template" "thread_local" "virtual") > >> Makes sense to me; perhaps Alan has some comments, so I've added him to > >> the CCs. > > As the maintainer of CC Mode, i'm in two minds over this. It's clearly > > a step in the right direction. But there's a non-trivial amount of work > > to be done to implement C++20's new features, and having just those few > > new keywords and nothing else in the release branch might jar. > There wasn't much followup here. Sorry, I think that was my fault. > Alan, isn't the proposed patch a step in the right direction anyway, > even if it doesn't add full C++20 support? Yes, I think it's time to apply the patch. It would have been a year ago, too. Are you (Lars) going to apply it, or should I? Just as a matter of interest, I'm working on C++20 stuff at the moment, and have an almost ready implementation of module/import/export. -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#51092: [PATCH] Recognize consteval and constinit modifiers in C++ 2022-09-13 17:26 ` Alan Mackenzie @ 2022-09-14 12:32 ` Lars Ingebrigtsen 0 siblings, 0 replies; 8+ messages in thread From: Lars Ingebrigtsen @ 2022-09-14 12:32 UTC (permalink / raw) To: Alan Mackenzie; +Cc: 51092, Evan Klitzke Alan Mackenzie <acm@muc.de> writes: > Yes, I think it's time to apply the patch. It would have been a year > ago, too. Are you (Lars) going to apply it, or should I? I've now pushed the patch to Emacs 29. > Just as a matter of interest, I'm working on C++20 stuff at the moment, > and have an almost ready implementation of module/import/export. Great! ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-09-14 12:32 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-10-08 1:10 bug#51092: [PATCH] Recognize consteval and constinit modifiers in C++ Evan Klitzke 2021-10-08 11:02 ` Lars Ingebrigtsen 2021-10-12 10:54 ` Alan Mackenzie 2021-10-12 14:13 ` Eli Zaretskii 2021-10-14 18:22 ` Evan Klitzke 2022-09-10 5:19 ` Lars Ingebrigtsen 2022-09-13 17:26 ` Alan Mackenzie 2022-09-14 12:32 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).