Re: Implementing p0515 - spaceship operator
Hello Jakub, I must confess that in the last months I've not been able to find much time (I do this in my spare time) to work on this. Part of the problem is also that my new employer hasn't yet provided a written copyright waiver for the FSF, though they have agreed and my contract already works out well in that regard. I would very much like to continue this project, but I'm very happy to collaborate and join forces to get this feature further. I hang out on the CppSlack as vdeurzen, if you want to contact me on another platform. Are there other platforms for GCC development that are well suited to discussing this topic? Best regards, Tim. On 8/30/18 8:16 PM, Marek Polacek wrote: On Thu, Aug 30, 2018 at 08:07:05PM +0200, Jakub Jelinek wrote: On Thu, Jan 11, 2018 at 02:06:06PM +, Joseph Myers wrote: On Thu, 11 Jan 2018, David Brown wrote: Maybe it is easier to say "gcc supports <=> in C++2a, and as an extension also supports it in C and C++ of any standard" ? I don't believe there is any way for it to conflict with existing valid code, so it would do no harm as a gcc extension like that - and C users can then use it too. As per previous IRC discussion, changing the lexing to support this pp-token can break valid code in previous standards, e.g. code concatenating <=> and >, then stringizing the result (the C++ proposal for adding this feature also notes some obscure cases where the character sequence <=> can actually occur as tokens, not just pp-tokens - "X<&Y::operator<=>" and "x+&operator<=>y" - so of course patches adding this feature should add testcases using such cases with older -std= options). Changes to cpp_avoid_paste (so that preprocessed output does not put a pp-token starting with > immediately after <=) do not need to be conditional on the standard version, however. Here is a patch that attempts to implement this (in libcpp + gcc/testsuite only so far). It needs to be parsed and handled in the C++ FE obviously, which is missing. Thanks. Tim, have you had any success with this, or should I (or somebody else) feel free to take it over? Marek
Re: Implementing p0515 - spaceship operator
Hi Jason, I've received a lot of good advice from Nathan, but haven't had an opportunity to apply it yet. I'm happy, however, to show / commit what I have so far (which covers the parsing of the operator). I've been working from the git repository until now, but from the mailing list I gather that this is not the main development RCS yet. How and/or where would you prefer my changes to be sent to? Just as a patch to the mailing list or rather as a new branch in the SVN repo? If the latter is the case I would need a bit of assistance as it's been years since I've worked with SVN. When exactly is the feature deadline? Tim. P.S. I will make time this month to start applying Nathan's advice and push the implementation to the next step. P.P.S. The copyright situation has been resolved and I can continue contributing without issue. On 11/5/18 2:22 AM, Jason Merrill wrote: On Wed, Sep 26, 2018 at 11:00 AM Jason Merrill wrote: On Mon, Sep 3, 2018 at 5:04 PM, Tim van Deurzen wrote: I must confess that in the last months I've not been able to find much time (I do this in my spare time) to work on this. Part of the problem is also that my new employer hasn't yet provided a written copyright waiver for the FSF, though they have agreed and my contract already works out well in that regard. Any progress on this? Has this been worked out? We're getting near the end of GCC stage 1, which is the deadline for new features going into the next release, so it would be great to see a patch with whatever you have so far. Jason
Re: Implementing p0515 - spaceship operator
Will take care of it this evening then. If I get stuck or need some help I'll try the IRC channel or reply to this mail again :). Tim. On 11/5/18 8:40 AM, Jakub Jelinek wrote: On Mon, Nov 05, 2018 at 08:36:44AM +0100, Tim van Deurzen wrote: I've received a lot of good advice from Nathan, but haven't had an opportunity to apply it yet. I'm happy, however, to show / commit what I have so far (which covers the parsing of the operator). I've been working from the git repository until now, but from the mailing list I gather that this is not the main development RCS yet. How and/or where would you prefer my changes to be sent to? Just as a patch to the mailing list or rather as a new branch in the SVN repo? If the latter is the case I would need a bit of assistance as it's been years since I've worked with SVN. When exactly is the feature deadline? The deadline is end of November 11th, timezone of your choice. Patches should be just posted to gcc-patches at gcc dot gnu dot org mailing list. If you could do it today or tomorrow, it would be really appreciated. Jakub
Implementing p0515 - spaceship operator
Hi, I've been spending some time the past few weeks implementing p0515r2, i.e. the proposal for consistent comparisons for C++ (aka the spaceship operator). I've received some very valuable help on the IRC channel, but I'm still a little bit stuck. Note, I'm completely new to the GCC codebase and am very much still getting oriented. Following advice from some of the people in IRC channel I implemented parsing the new token in libcpp and I seem to be successfully parsing it and creating a new AST node. As this feature is not in the C++ standard yet, I wanted to add a command line flag to enable usage of the new operator and ignoring it otherwise. I managed to get cc1plus to accept the parameter, but it seems that when I invoke my own g++ binary with that parameter, it complains about unknown parameters. I'm perfectly happy to dig further on my own, but I get the feeling I'm missing some documentation / resource somewhere that might help me out. Is there some documentation about adding and passing around parameters that will be used both in libcpp and the C++ front-end? What would be the best place to look to learn more about how part of GCC this is structured? I want to make sure I go about this correctly. If this is the wrong place to ask for help, please redirect me, so that I don't unnecessarily spam the wrong mailing list :-). Kind regards, Tim.
Re: Implementing p0515 - spaceship operator
On 01/08/2018 11:28 PM, Jason Merrill wrote: On Mon, Jan 8, 2018 at 5:13 PM, Jonathan Wakely wrote: On 8 January 2018 at 22:07, Jason Merrill wrote: On Mon, Jan 8, 2018 at 4:07 PM, Tim van Deurzen wrote: I've been spending some time the past few weeks implementing p0515r2, i.e. the proposal for consistent comparisons for C++ (aka the spaceship operator). Great! I've received some very valuable help on the IRC channel, but I'm still a little bit stuck. Note, I'm completely new to the GCC codebase and am very much still getting oriented. Following advice from some of the people in IRC channel I implemented parsing the new token in libcpp and I seem to be successfully parsing it and creating a new AST node. As this feature is not in the C++ standard yet, I wanted to add a command line flag to enable usage of the new operator and ignoring it otherwise. I managed to get cc1plus to accept the parameter, but it seems that when I invoke my own g++ binary with that parameter, it complains about unknown parameters. I'm perfectly happy to dig further on my own, but I get the feeling I'm missing some documentation / resource somewhere that might help me out. Is there some documentation about adding and passing around parameters that will be used both in libcpp and the C++ front-end? What would be the best place to look to learn more about how part of GCC this is structured? I want to make sure I go about this correctly. There's a gccint.info documentation file, the Options node seems like what you're looking for. You will want to add a new option to c-family/c.opt. operator<=> is now in the working paper though, so does it need its own option? IMHO it should just be enabled for -std=c++2a and -std=gnu++2a, and not otherwise. Ah, good point. Jason That makes sense, I'll just use the c++2a and gnu++2a flags. Though I'll still take some time to figure out how options work, so that I can add any toggles that (e.g. for warnings) that might be specific to operator<=>. Just to confirm with you, it does make sense to conditionally parse the token for operator<=> in libcpp (i.e. only when the cxx standard being used is >=2a)? I'm just wondering if this does not accidentally affect other front-ends using libcpp? Tim.
Re: Implementing p0515 - spaceship operator
On 01/10/2018 02:00 PM, Jonathan Wakely wrote: On 9 Jan 2018 10:56 p.m., "Tim van Deurzen" wrote: Just to confirm with you, it does make sense to conditionally parse the token for operator<=> in libcpp (i.e. only when the cxx standard being used is >=2a)? I'm just wondering if this does not accidentally affect other front-ends using libcpp? Other front ends won't setthe language to C++2a. I think the relevant check is: if (CPP_OPTION (pfile, lang) == CLK_CXX2A || CPP_OPTION (pfile, lang) == CLK_GNUCXX2A) This can only be true for a C++ source file when the standard is C++2a. Ok, good to know, then I'll proceed like this. Thank you! Tim.
Re: Implementing p0515 - spaceship operator
Hi Jakub, On 01/10/2018 10:32 PM, Jakub Jelinek wrote: On Wed, Jan 10, 2018 at 10:24:00PM +0100, Tim van Deurzen wrote: On 01/10/2018 02:00 PM, Jonathan Wakely wrote: On 9 Jan 2018 10:56 p.m., "Tim van Deurzen" wrote: Just to confirm with you, it does make sense to conditionally parse the token for operator<=> in libcpp (i.e. only when the cxx standard being used is >=2a)? I'm just wondering if this does not accidentally affect other front-ends using libcpp? Other front ends won't setthe language to C++2a. I think the relevant check is: if (CPP_OPTION (pfile, lang) == CLK_CXX2A || CPP_OPTION (pfile, lang) == CLK_GNUCXX2A) This can only be true for a C++ source file when the standard is C++2a. Ok, good to know, then I'll proceed like this. Thank you! Well, the usual way of doing stuff is add another field to struct lang_flags, add it to the lang_defaults table, add it to struct cpp_options too and then use CPP_OPTION (pfile, spaceship) or so, e.g. look how va_opt etc. are implemented. Jakub I think, I got almost all of that at some point, but probably missed something somewhere. For now I will proceed with the cxx standard flags. If I add any kind of warning or toggle I'll have a good idea where to start at this point. Thank you! Tim.
Copyright Assignment
Hi, I've written to this list previously to mention I'm working on implementing p0515 (the spaceship operator) for C++. Although I'm still far from finished I'd like to make sure that when I am, I will be able to contribute my changes to GCC. Please tell me what I should do to take care of the copyright assignment. Thank you! Tim.