Re: confirm subscribe to gcc-patches@gcc.gnu.org

2018-11-05 Thread Tim van Deurzen
On 11/05/2018 11:32 PM, gcc-patches-h...@gcc.gnu.org wrote:
> Hi! This is the ezmlm program. I'm managing the
> gcc-patches@gcc.gnu.org mailing list.
>
> To confirm that you would like
>
>t...@kompiler.org
>
> added to the gcc-patches mailing list, please send
> an empty reply to this address:
>
>gcc-patches-sc.1541457171.macebnkebakhpagdepob-tim=kompiler@gcc.gnu.org
>
> Usually, this happens when you just hit the "reply" button.
> If this does not work, simply copy the address and paste it into
> the "To:" field of a new message.
>
> This confirmation serves two purposes. First, it verifies that I am able
> to get mail through to you. Second, it protects you in case someone
> forges a subscription request in your name.
>
> Some mail programs are broken and cannot handle long addresses. If you
> cannot reply to this request, instead send a message to
>  and put the
> entire address listed above into the "Subject:" line.
>
>
> --- Administrative commands for the gcc-patches list ---
>
> I can handle administrative requests automatically. Please
> do not send them to the list address! Instead, send
> your message to the correct command address:
>
> To subscribe to the list, send a message to:
>
>
> To remove your address from the list, send a message to:
>
>
> Send mail to the following for info and FAQ for this list:
>
>
>
> Similar addresses exist for the digest list:
>
>
>
> To get messages 123 through 145 (a maximum of 100 per request), mail:
>
>
> To get an index with subject and author for messages 123-456 , mail:
>
>
> They are always returned as sets of 100, max 2000 per request,
> so you'll actually get 100-499.
>
> To receive all messages with the same subject as message 12345,
> send an empty message to:
>
>
> The messages do not really need to be empty, but I will ignore
> their content. Only the ADDRESS you send to is important.
>
> You can start a subscription for an alternate address,
> for example "john@host.domain", just add a hyphen and your
> address (with '=' instead of '@') after the command word:
> 
>
> To stop subscription for this address, mail:
> 
>
> In both cases, I'll send a confirmation message to that address. When
> you receive it, simply reply to it to complete your subscription.
>
> If despite following these instructions, you do not get the
> desired results, please contact my owner at
> gcc-patches-ow...@gcc.gnu.org. Please be patient, my owner is a
> lot slower than I am ;-)
>
> --- Enclosed is a copy of the request I received.
>
> Return-Path: 
> Received: (qmail 96649 invoked by uid 48); 5 Nov 2018 22:32:50 -
> Message-ID: <20181105223250.96646.qm...@sourceware.org>
> From: anonym...@sourceware.org
> Date: Mon, 05 Nov 2018 22:32:50 +
> To: gcc-patches-subscribe-tim=kompiler@sourceware.org
> User-Agent: Heirloom mailx 12.4 7/29/08
> MIME-Version: 1.0
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
>



Parsing of spaceship operator (work in progress)

2018-11-05 Thread Tim van Deurzen
Hello all,

I've been getting to know my way around the c++ compiler front-end while
implementing the spaceship operator. To ensure this feature is part of
the next release I'm including my work so far as a patch. Testing and
development are still very much ongoing.

This patch adds only the new token from the pre-pocessor and its
recognition / use in the C++ front-end.

Tim.


diff --git gcc/cp/ChangeLog gcc/cp/ChangeLog
index b0dc668d9df..cb5ab8feb05 100644
--- gcc/cp/ChangeLog
+++ gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+2018-11-05  Tim van Deurzen  
+
+    Add new tree code for the spaceship operator.
+    * cp-tree.def: Add new tree code.
+    Add new operator.
+    * operators.def: New binary operator.
+    Implement parsing of the spaceship operator.
+    * parser.c: Add new token and tree code.
+
 2018-11-04  Jason Merrill  
 
 Implement UDL changes from P0732R2.
diff --git gcc/cp/cp-tree.def gcc/cp/cp-tree.def
index c64225ded6f..6da2d6b9b38 100644
--- gcc/cp/cp-tree.def
+++ gcc/cp/cp-tree.def
@@ -594,6 +594,7 @@ DEFTREECODE (PARM_CONSTR, "parm_constr",
tcc_expression, 2)
 DEFTREECODE (CONJ_CONSTR, "conj_constr", tcc_expression, 2)
 DEFTREECODE (DISJ_CONSTR, "disj_constr", tcc_expression, 2)
 
+DEFTREECODE (SPACESHIP_EXPR, "spaceship_expr", tcc_expression, 2)
 
 /*
 Local variables:
diff --git gcc/cp/operators.def gcc/cp/operators.def
index 07f586b1c28..ac96e27c124 100644
--- gcc/cp/operators.def
+++ gcc/cp/operators.def
@@ -110,6 +110,7 @@ DEF_OPERATOR ("<", LT_EXPR, "lt", OVL_OP_FLAG_BINARY)
 DEF_OPERATOR (">", GT_EXPR, "gt", OVL_OP_FLAG_BINARY)
 DEF_OPERATOR ("<=", LE_EXPR, "le", OVL_OP_FLAG_BINARY)
 DEF_OPERATOR (">=", GE_EXPR, "ge", OVL_OP_FLAG_BINARY)
+DEF_OPERATOR ("<=>", SPACESHIP_EXPR, "le", OVL_OP_FLAG_BINARY)
 DEF_OPERATOR ("&&", TRUTH_ANDIF_EXPR, "aa", OVL_OP_FLAG_BINARY)
 DEF_OPERATOR ("||", TRUTH_ORIF_EXPR, "oo", OVL_OP_FLAG_BINARY)
 DEF_OPERATOR (",", COMPOUND_EXPR, "cm", OVL_OP_FLAG_BINARY)
diff --git gcc/cp/parser.c gcc/cp/parser.c
index 30a47662f55..c0de47a7550 100644
--- gcc/cp/parser.c
+++ gcc/cp/parser.c
@@ -1893,6 +1893,8 @@ static const cp_parser_binary_operations_map_node
binops[] = {
   { CPP_LSHIFT, LSHIFT_EXPR, PREC_SHIFT_EXPRESSION },
   { CPP_RSHIFT, RSHIFT_EXPR, PREC_SHIFT_EXPRESSION },
 
+  /* FIXME check precedence of spaceship operator. */
+  { CPP_SPACESHIP, SPACESHIP_EXPR, PREC_RELATIONAL_EXPRESSION },
   { CPP_LESS, LT_EXPR, PREC_RELATIONAL_EXPRESSION },
   { CPP_GREATER, GT_EXPR, PREC_RELATIONAL_EXPRESSION },
   { CPP_LESS_EQ, LE_EXPR, PREC_RELATIONAL_EXPRESSION },
@@ -15052,6 +15054,10 @@ cp_parser_operator (cp_parser* parser)
   op = GE_EXPR;
   break;
 
+    case CPP_SPACESHIP:
+  op = SPACESHIP_EXPR;
+      break;
+
 case CPP_AND_AND:
   op = TRUTH_ANDIF_EXPR;
   break;
diff --git libcpp/ChangeLog libcpp/ChangeLog
index 4f280471ba4..5a73b66b3e8 100644
--- libcpp/ChangeLog
+++ libcpp/ChangeLog
@@ -1,3 +1,7 @@
+2018-11-05  Tim van Deurzen  
+    * cpplib.h: Add spaceship operator for C++.
+    * lex.c: Implement conditional lexing of spaceship operator for C++20.
+
 2018-11-05  Martin Liska  
 
 * symtab.c (ht_dump_statistics): Replace %zu with %lu format.
diff --git libcpp/include/cpplib.h libcpp/include/cpplib.h
index aad836d2192..55869278f5f 100644
--- libcpp/include/cpplib.h
+++ libcpp/include/cpplib.h
@@ -78,6 +78,7 @@ struct _cpp_file;
   OP(NOT_EQ,        "!=")                        \
   OP(GREATER_EQ,    ">=")                        \
   OP(LESS_EQ,        "<=")                        \
+  OP(SPACESHIP,        "<=>")                        \
                                 \
   /* These two are unary + / - in preprocessor expressions.  */        \
   OP(PLUS_EQ,        "+=")    /* math */                \
diff --git libcpp/lex.c libcpp/lex.c
index c6e34b33343..b6423d15cc6 100644
--- libcpp/lex.c
+++ libcpp/lex.c
@@ -2963,7 +2963,14 @@ _cpp_lex_direct (cpp_reader *pfile)
 
   result->type = CPP_LESS;
   if (*buffer->cur == '=')
-    buffer->cur++, result->type = CPP_LESS_EQ;
+  if (CPP_OPTION(pfile, cplusplus)
+  && (CPP_OPTION(pfile, lang) == CLK_CXX2A ||
CPP_OPTION(pfile, lang) == CLK_GNUCXX2A)
+  && buffer->cur[1] == '>')
+    {
+  buffer->cur += 2, result->type = CPP_SPACESHIP;
+    } else {
+  buffer->cur++, result->type = CPP_LESS_EQ;
+    }
   else if (*buffer->cur == '<')
 {
   buffer->cur++;

diff --git gcc/cp/ChangeLog gcc/cp/ChangeLog
index b0dc668d9df..cb5ab8feb05 100644
--- gcc/cp/ChangeLog
+++ gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+20