From a2d0ac35867d204d98801c152b5662d7fbf31066 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 17 Jun 2022 16:29:14 +0200
Subject: [PATCH] Bytecode: remove unused expression types

---
 mex/sources/bytecode/ErrorHandling.hh | 39 -----------
 mex/sources/bytecode/Evaluate.cc      | 99 ---------------------------
 preprocessor                          |  2 +-
 3 files changed, 1 insertion(+), 139 deletions(-)

diff --git a/mex/sources/bytecode/ErrorHandling.hh b/mex/sources/bytecode/ErrorHandling.hh
index b5b14cf36e..32ccc6987c 100644
--- a/mex/sources/bytecode/ErrorHandling.hh
+++ b/mex/sources/bytecode/ErrorHandling.hh
@@ -366,12 +366,6 @@ public:
           else
             Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to deterministic exogenous variable " << get_variable(SymbolType::endogenous, EQN_dvar1) << " at time " << it_;
           break;
-        case ExpressionType::FirstParamDerivative:
-          if (EQN_block_number > 1)
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to parameter "  << get_variable(SymbolType::endogenous, EQN_dvar1) << " at time " << it_;
-          else
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to parameter " << get_variable(SymbolType::endogenous, EQN_dvar1) << " at time " << it_;
-          break;
         default:
           return "???";
         }
@@ -414,12 +408,6 @@ public:
           else
             Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to deterministic exogenous variable " << get_variable(SymbolType::endogenous, EQN_dvar1);
           break;
-        case ExpressionType::FirstParamDerivative:
-          if (EQN_block_number > 1)
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to parameter "  << get_variable(SymbolType::endogenous, EQN_dvar1);
-          else
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to parameter " << get_variable(SymbolType::endogenous, EQN_dvar1);
-          break;
         default:
           return ("???");
         }
@@ -484,33 +472,6 @@ public:
               case ExpressionType::FirstExodetDerivative:
                 equation_type = ExpressionType::FirstExodetDerivative;
                 break;
-              case ExpressionType::FirstParamDerivative:
-                equation_type = ExpressionType::FirstParamDerivative;
-                break;
-              case ExpressionType::SecondEndoDerivative:
-                equation_type = ExpressionType::SecondEndoDerivative;
-                break;
-              case ExpressionType::SecondExoDerivative:
-                equation_type = ExpressionType::SecondExoDerivative;
-                break;
-              case ExpressionType::SecondExodetDerivative:
-                equation_type = ExpressionType::SecondExodetDerivative;
-                break;
-              case ExpressionType::SecondParamDerivative:
-                equation_type = ExpressionType::SecondExodetDerivative;
-                break;
-              case ExpressionType::ThirdEndoDerivative:
-                equation_type = ExpressionType::ThirdEndoDerivative;
-                break;
-              case ExpressionType::ThirdExoDerivative:
-                equation_type = ExpressionType::ThirdExoDerivative;
-                break;
-              case ExpressionType::ThirdExodetDerivative:
-                equation_type = ExpressionType::ThirdExodetDerivative;
-                break;
-              case ExpressionType::ThirdParamDerivative:
-                equation_type = ExpressionType::ThirdExodetDerivative;
-                break;
               default:
                 ostringstream tmp;
                 tmp << " in print_expression, expression type " << static_cast<int>(static_cast<FNUMEXPR_ *>(it_code->second)->get_expression_type()) << " not implemented yet\n";
diff --git a/mex/sources/bytecode/Evaluate.cc b/mex/sources/bytecode/Evaluate.cc
index c959f52ab8..55a2b2ecbd 100644
--- a/mex/sources/bytecode/Evaluate.cc
+++ b/mex/sources/bytecode/Evaluate.cc
@@ -196,105 +196,6 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative)
               EQN_dvar1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable1();
               EQN_lag1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag1();
               break;
-            case ExpressionType::FirstParamDerivative:
-#ifdef DEBUG
-              mexPrintf("FirstParamDerivative\n");
-#endif
-              EQN_type = ExpressionType::FirstParamDerivative;
-              EQN_equation = static_cast<FNUMEXPR_ *>(it_code->second)->get_equation();
-              EQN_dvar1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable1();
-              break;
-            case ExpressionType::SecondEndoDerivative:
-#ifdef DEBUG
-              mexPrintf("SecondEndoDerivative\n");
-#endif
-              EQN_type = ExpressionType::SecondEndoDerivative;
-              EQN_equation = static_cast<FNUMEXPR_ *>(it_code->second)->get_equation();
-              EQN_dvar1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable1();
-              EQN_lag1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag1();
-              EQN_dvar2 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable2();
-              EQN_lag2 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag2();
-              break;
-            case ExpressionType::SecondExoDerivative:
-#ifdef DEBUG
-              mexPrintf("SecondExoDerivative\n");
-#endif
-              EQN_type = ExpressionType::SecondExoDerivative;
-              EQN_equation = static_cast<FNUMEXPR_ *>(it_code->second)->get_equation();
-              EQN_dvar1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable1();
-              EQN_lag1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag1();
-              EQN_dvar2 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable2();
-              EQN_lag2 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag2();
-              break;
-            case ExpressionType::SecondExodetDerivative:
-#ifdef DEBUG
-              mexPrintf("SecondExodetDerivative\n");
-#endif
-              EQN_type = ExpressionType::SecondExodetDerivative;
-              EQN_equation = static_cast<FNUMEXPR_ *>(it_code->second)->get_equation();
-              EQN_dvar1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable1();
-              EQN_lag1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag1();
-              EQN_dvar2 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable2();
-              EQN_lag2 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag2();
-              break;
-            case ExpressionType::SecondParamDerivative:
-#ifdef DEBUG
-              mexPrintf("SecondParamDerivative\n");
-#endif
-              EQN_type = ExpressionType::SecondParamDerivative;
-              EQN_equation = static_cast<FNUMEXPR_ *>(it_code->second)->get_equation();
-              EQN_dvar1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable1();
-              EQN_dvar2 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable2();
-              break;
-            case ExpressionType::ThirdEndoDerivative:
-#ifdef DEBUG
-              mexPrintf("ThirdEndoDerivative\n");
-#endif
-              EQN_type = ExpressionType::ThirdEndoDerivative;
-              EQN_equation = static_cast<FNUMEXPR_ *>(it_code->second)->get_equation();
-              EQN_dvar1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable1();
-              EQN_lag1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag1();
-              EQN_dvar2 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable2();
-              EQN_lag2 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag2();
-              EQN_dvar3 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable3();
-              EQN_lag3 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag3();
-              break;
-            case ExpressionType::ThirdExoDerivative:
-#ifdef DEBUG
-              mexPrintf("ThirdExoDerivative\n");
-#endif
-              EQN_type = ExpressionType::ThirdExoDerivative;
-              EQN_equation = static_cast<FNUMEXPR_ *>(it_code->second)->get_equation();
-              EQN_dvar1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable1();
-              EQN_lag1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag1();
-              EQN_dvar2 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable2();
-              EQN_lag2 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag2();
-              EQN_dvar3 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable3();
-              EQN_lag3 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag3();
-              break;
-            case ExpressionType::ThirdExodetDerivative:
-#ifdef DEBUG
-              mexPrintf("ThirdExodetDerivative\n");
-#endif
-              EQN_type = ExpressionType::ThirdExodetDerivative;
-              EQN_equation = static_cast<FNUMEXPR_ *>(it_code->second)->get_equation();
-              EQN_dvar1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable1();
-              EQN_lag1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag1();
-              EQN_dvar2 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable2();
-              EQN_lag2 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag2();
-              EQN_dvar3 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable3();
-              EQN_lag3 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag3();
-              break;
-            case ExpressionType::ThirdParamDerivative:
-#ifdef DEBUG
-              mexPrintf("ThirdParamDerivative\n");
-#endif
-              EQN_type = ExpressionType::ThirdParamDerivative;
-              EQN_equation = static_cast<FNUMEXPR_ *>(it_code->second)->get_equation();
-              EQN_dvar1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable1();
-              EQN_dvar2 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable2();
-              EQN_dvar3 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable3();
-              break;
             }
           break;
         case Tags::FLDV:
diff --git a/preprocessor b/preprocessor
index b3b8ed63e1..2ea6a5244e 160000
--- a/preprocessor
+++ b/preprocessor
@@ -1 +1 @@
-Subproject commit b3b8ed63e10ab7a147681ed625d158903d72913b
+Subproject commit 2ea6a5244e38b6babbd56a5e9773e5434dd246cb
-- 
GitLab