lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 75d8632 2/5: Suppress PETE's operator<<=()


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 75d8632 2/5: Suppress PETE's operator<<=()
Date: Sun, 21 Mar 2021 21:10:52 -0400 (EDT)

branch: master
commit 75d8632041b7ca2dc39c7f64bfd729706caa9685
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Suppress PETE's operator<<=()
    
    Removed the "OpLeftShiftAssign" section from 'PeteOps.in', preventing
    PETE from generating operator<<=(), so that it can be repurposed for
    vector assignment from a PETE expression.
    
    Alternatives not pursued:
     - Comment that section out. It is not apparent whether PETE's parser
       implements comments.
     - Add a PETE_OMIT_LEFT_SHIFT_ASSIGN macro and a corresponding command-
       line option (akin to the existing PETE_ALLOW_SCALAR_SHIFT and
       '--no-shift-guard') to suppress "OpLeftShiftAssign", optionally,
       when MakeOperators is run. But MakeOperators knows only groups of
       operators, like "binaryAssignOps"; it doesn't know about individual
       operators, and cannot suppress them selectively.
    
    * tools/pete-2.1.1/PETE/Tools/PeteOps.in: Remove "OpLeftShiftAssign".
    * tools/pete-2.1.1/PETE/OperatorTags.h: Automatically generated.
    * tools/pete-2.1.1/PETE/Tools/PeteOps.cpp: Automatically generated.
    * tools/pete-2.1.1/et_vector_operators.hpp: Automatically generated.
---
 tools/pete-2.1.1/PETE/OperatorTags.h     | 16 ----------------
 tools/pete-2.1.1/PETE/Tools/PeteOps.cpp  |  5 -----
 tools/pete-2.1.1/PETE/Tools/PeteOps.in   |  4 ----
 tools/pete-2.1.1/et_vector_operators.hpp |  9 ---------
 4 files changed, 34 deletions(-)

diff --git a/tools/pete-2.1.1/PETE/OperatorTags.h 
b/tools/pete-2.1.1/PETE/OperatorTags.h
index 799eca0..a913b9d 100644
--- a/tools/pete-2.1.1/PETE/OperatorTags.h
+++ b/tools/pete-2.1.1/PETE/OperatorTags.h
@@ -730,22 +730,6 @@ struct BinaryReturn<T1, T2, OpBitwiseXorAssign > {
   typedef T1 &Type_t;
 };
 
-struct OpLeftShiftAssign
-{
-  PETE_EMPTY_CONSTRUCTORS(OpLeftShiftAssign)
-  template<class T1, class T2>
-  inline typename BinaryReturn<T1, T2, OpLeftShiftAssign >::Type_t
-  operator()(const T1 &a, const T2 &b) const
-  {
-    (const_cast<T1 &>(a) <<= b); return const_cast<T1 &>(a);
-  }
-};
-
-template<class T1, class T2 >
-struct BinaryReturn<T1, T2, OpLeftShiftAssign > {
-  typedef T1 &Type_t;
-};
-
 struct OpRightShiftAssign
 {
   PETE_EMPTY_CONSTRUCTORS(OpRightShiftAssign)
diff --git a/tools/pete-2.1.1/PETE/Tools/PeteOps.cpp 
b/tools/pete-2.1.1/PETE/Tools/PeteOps.cpp
index eb50092..7864101 100644
--- a/tools/pete-2.1.1/PETE/Tools/PeteOps.cpp
+++ b/tools/pete-2.1.1/PETE/Tools/PeteOps.cpp
@@ -84,11 +84,6 @@ void peteOps(map<string,vector<OperatorDescriptor> > &m)
                                  "(const_cast<T1 &>(a) ^= b); return 
const_cast<T1 &>(a);",
                                  ""));
   m["binaryAssignOps"].push_back(
-              OperatorDescriptor("OpLeftShiftAssign",
-                                 "operator<<=",
-                                 "(const_cast<T1 &>(a) <<= b); return 
const_cast<T1 &>(a);",
-                                 ""));
-  m["binaryAssignOps"].push_back(
               OperatorDescriptor("OpRightShiftAssign",
                                  "operator>>=",
                                  "(const_cast<T1 &>(a) >>= b); return 
const_cast<T1 &>(a);",
diff --git a/tools/pete-2.1.1/PETE/Tools/PeteOps.in 
b/tools/pete-2.1.1/PETE/Tools/PeteOps.in
index bc52a4c..3846d01 100644
--- a/tools/pete-2.1.1/PETE/Tools/PeteOps.in
+++ b/tools/pete-2.1.1/PETE/Tools/PeteOps.in
@@ -238,10 +238,6 @@ binaryAssignOps
   FUNCTION = "operator^="
   EXPR = "(const_cast<T1 &>(a) ^= b); return const_cast<T1 &>(a);"
 -----
-  TAG = "OpLeftShiftAssign"
-  FUNCTION = "operator<<="
-  EXPR = "(const_cast<T1 &>(a) <<= b); return const_cast<T1 &>(a);"
------
   TAG = "OpRightShiftAssign"
   FUNCTION = "operator>>="
   EXPR = "(const_cast<T1 &>(a) >>= b); return const_cast<T1 &>(a);"
diff --git a/tools/pete-2.1.1/et_vector_operators.hpp 
b/tools/pete-2.1.1/et_vector_operators.hpp
index b487ac0..d7aa9bc 100644
--- a/tools/pete-2.1.1/et_vector_operators.hpp
+++ b/tools/pete-2.1.1/et_vector_operators.hpp
@@ -3220,15 +3220,6 @@ std::vector<T1>& operator^=(std::vector<T1>& lhs,const 
RHS& rhs)
 
 template<class T1,class RHS>
 inline
-std::vector<T1>& operator<<=(std::vector<T1>& lhs,const RHS& rhs)
-{
-  typedef typename CreateLeaf<RHS>::Leaf_t Leaf_t;
-  
evaluate(lhs,OpLeftShiftAssign(),MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
-  return lhs;
-}
-
-template<class T1,class RHS>
-inline
 std::vector<T1>& operator>>=(std::vector<T1>& lhs,const RHS& rhs)
 {
   typedef typename CreateLeaf<RHS>::Leaf_t Leaf_t;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]