]> sourceware.org Git - systemtap.git/commitdiff
Add unsigned right shift operator
authorRichard Henderson <rth@redhat.com>
Thu, 20 Jul 2017 10:18:58 +0000 (03:18 -0700)
committerRichard Henderson <rth@redhat.com>
Thu, 20 Jul 2017 10:18:58 +0000 (03:18 -0700)
Use >>> as suggestd by fche, replacing the u>> placeholder
that I had forgotten about upon initiating the loc2stap branch.

bpf-translate.cxx
doc/langref.tex
loc2stap.cxx
parse.cxx
translate.cxx

index a52954e1446094738308a738f5d96a73baf6e092..347c36fc05e83db61c3fcdcf71135a35ca1fc5c7 100644 (file)
@@ -840,6 +840,8 @@ bpf_unparser::visit_binary_expression (binary_expression* e)
     code = BPF_LSH;
   else if (e->op == ">>")
     code = BPF_ARSH;
+  else if (e->op == ">>>")
+    code = BPF_RSH;
   else if (e->op == "/")
     code = BPF_DIV;
   else if (e->op == "%")
index 77a5a2c6a331f069a013875f47c8f03d4406c6de..bd2b84bea28017dbb8a8336f6036f6cba5d90b7e 100644 (file)
@@ -2001,7 +2001,7 @@ it generates an error. The following subsections list these operators.
 
 \subsubsection{Binary numeric operators}
 \index{binary}
-\texttt{{*} / \% + - >\,{}> <\,{}< \& \textasciicircum{}
+\texttt{{*} / \% + - >\,{}> >\,{}>\,{}> <\,{}< \& \textasciicircum{}
 | \&\& ||}
 
 \subsubsection{Binary string operators}
index 7d067944758e7a9e52f8ff97978ae7ed15784e13..091414cba4ec4e66850901244fa05d50afa04b55 100644 (file)
@@ -523,7 +523,7 @@ location_context::translate (const Dwarf_Op *expr, const size_t len,
            BINOP (or, binary_expression, |);
            BINOP (plus, binary_expression, +);
            BINOP (shl, binary_expression, <<);
-           BINOP (shr, binary_expression, u>>);
+           BINOP (shr, binary_expression, >>>);
            BINOP (shra, binary_expression, >>);
            BINOP (xor, binary_expression, ^);
            BINOP (div, binary_expression, /);
index b31976e591060e8d9cd5a3cc08848d960399c351..0b50c0b8ba38e76babe1b2bc223ec35bb1c1eb3b 100644 (file)
--- a/parse.cxx
+++ b/parse.cxx
@@ -1798,6 +1798,7 @@ skip:
 
       // match all valid operators, in decreasing size order
       if ((c == '<' && c2 == '<' && c3 == '<') ||
+          (c == '>' && c2 == '>' && c3 == '>') ||
           (c == '<' && c2 == '<' && c3 == '=') ||
           (c == '>' && c2 == '>' && c3 == '='))
         {
@@ -3501,7 +3502,7 @@ parser::parse_shift ()
 
   const token* t = peek ();
   while (t && t->type == tok_operator &&
-         (t->content == "<<" || t->content == ">>"))
+         (t->content == "<<" || t->content == ">>" || t->content == ">>>"))
     {
       binary_expression* e = new binary_expression;
       e->left = op1;
index c434e67817f51696b2f54190fffa36b40f6b3013..972c1f228acea59e663d0307438bb3041aee65bf 100644 (file)
@@ -4755,6 +4755,14 @@ c_unparser::visit_binary_expression (binary_expression* e)
       e->right->visit (this);
       o->line() << ") & 63)";
     }
+  else if (e->op == ">>>")
+    {
+      o->line() << "(int64_t)((uint64_t)(";
+      e->left->visit (this);
+      o->line() << ") >> ((";
+      e->right->visit (this);
+      o->line() << ") & 63))";
+    }
   else if (e->op == "/" ||
            e->op == "%")
     {
@@ -4781,7 +4789,7 @@ c_unparser::visit_binary_expression (binary_expression* e)
       o->newline(-1) << "})";
     }
   else
-    throw SEMANTIC_ERROR (_("operator not yet implemented"), e->tok);
+    throw SEMANTIC_ERROR (_F("operator %s not yet implemented", string(e->op).c_str()), e->tok);
 }
 
 
This page took 1.098211 seconds and 5 git commands to generate.