From c3fc5b1dd799641fbbedfb420358e3dc6f5a4b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Fri, 24 Jun 2022 17:10:12 +0200 Subject: [PATCH] Enable -Wunused-parameter As a consequence, add many [[maybe_unused]] attributes for legitimate cases (mainly in virtual functions). --- configure.ac | 2 +- src/ComputingTasks.cc | 414 ++++++++++++++++++++++----------- src/DataTree.cc | 12 +- src/ExprNode.cc | 403 +++++++++++++++++++------------- src/ModelTree.cc | 6 +- src/NumericalInitialization.cc | 43 ++-- src/Shocks.cc | 43 ++-- src/SigmaeInitialization.cc | 3 +- src/Statement.cc | 11 +- src/StaticModel.cc | 4 +- src/macro/Directives.cc | 12 +- src/macro/Directives.hh | 2 +- src/macro/Expressions.cc | 4 +- src/macro/Expressions.hh | 68 +++--- 14 files changed, 644 insertions(+), 383 deletions(-) diff --git a/configure.ac b/configure.ac index ddd9846b..a1aa904e 100644 --- a/configure.ac +++ b/configure.ac @@ -43,7 +43,7 @@ esac # Use C++ for testing headers AC_LANG([C++]) -AM_CXXFLAGS="-std=gnu++20 -Wall -Wno-dangling-else -Wextra -Wno-unused-parameter -Wold-style-cast" +AM_CXXFLAGS="-std=gnu++20 -Wall -Wno-dangling-else -Wextra -Wold-style-cast" AC_SUBST([AM_CXXFLAGS]) # If default 'ar' is not available, try to find one with a host prefix (see ticket #145) diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc index 56903974..ff5bd4f1 100644 --- a/src/ComputingTasks.cc +++ b/src/ComputingTasks.cc @@ -45,13 +45,15 @@ SteadyStatement::SteadyStatement(OptionsList options_list_arg) : } void -SteadyStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +SteadyStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.steady_present = true; } void -SteadyStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +SteadyStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); output << "steady;" << endl; @@ -75,14 +77,16 @@ CheckStatement::CheckStatement(OptionsList options_list_arg) : } void -CheckStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +CheckStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); output << "oo_.dr.eigval = check(M_,options_,oo_);" << endl; } void -CheckStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +CheckStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.check_present = true; } @@ -105,7 +109,8 @@ ModelInfoStatement::ModelInfoStatement(OptionsList options_list_arg) : } void -ModelInfoStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +ModelInfoStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output, "options_model_info_"); output << "model_info(options_model_info_);" << endl; @@ -129,13 +134,15 @@ SimulStatement::SimulStatement(OptionsList options_list_arg) : } void -SimulStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +SimulStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.perfect_foresight_solver_present = true; } void -SimulStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +SimulStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { // Translate the “datafile” option into “initval_file” (see dynare#1663) auto options_list_new = options_list; // Need a copy, because of const @@ -171,7 +178,8 @@ PerfectForesightSetupStatement::PerfectForesightSetupStatement(OptionsList optio } void -PerfectForesightSetupStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +PerfectForesightSetupStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { auto options_list_new = options_list; // Need a copy, because of const if (auto it = options_list_new.string_options.find("datafile"); @@ -205,13 +213,15 @@ PerfectForesightSolverStatement::PerfectForesightSolverStatement(OptionsList opt } void -PerfectForesightSolverStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +PerfectForesightSolverStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.perfect_foresight_solver_present = true; } void -PerfectForesightSolverStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +PerfectForesightSolverStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); output << "perfect_foresight_solver;" << endl; @@ -235,7 +245,9 @@ PerfectForesightWithExpectationErrorsSetupStatement::PerfectForesightWithExpecta } void -PerfectForesightWithExpectationErrorsSetupStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +PerfectForesightWithExpectationErrorsSetupStatement::writeOutput(ostream &output, + [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); output << "perfect_foresight_with_expectation_errors_setup;" << endl; @@ -259,13 +271,16 @@ PerfectForesightWithExpectationErrorsSolverStatement::PerfectForesightWithExpect } void -PerfectForesightWithExpectationErrorsSolverStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +PerfectForesightWithExpectationErrorsSolverStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.perfect_foresight_with_expectation_errors_solver_present = true; } void -PerfectForesightWithExpectationErrorsSolverStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +PerfectForesightWithExpectationErrorsSolverStatement::writeOutput(ostream &output, + [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); output << "perfect_foresight_with_expectation_errors_solver;" << endl; @@ -291,7 +306,8 @@ PriorPosteriorFunctionStatement::PriorPosteriorFunctionStatement(const bool prio } void -PriorPosteriorFunctionStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +PriorPosteriorFunctionStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { if (auto it2 = options_list.string_options.find("function"); it2 == options_list.string_options.end() || it2->second.empty()) @@ -303,7 +319,8 @@ PriorPosteriorFunctionStatement::checkPass(ModFileStructure &mod_file_struct, Wa } void -PriorPosteriorFunctionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +PriorPosteriorFunctionStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); string type = prior_func ? "prior" : "posterior"; @@ -378,7 +395,8 @@ StochSimulStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli } void -StochSimulStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +StochSimulStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { // Ensure that order 3 implies k_order (#844) if (auto it = options_list.num_options.find("order"), @@ -418,7 +436,8 @@ ForecastStatement::ForecastStatement(SymbolList symbol_list_arg, OptionsList opt } void -ForecastStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +ForecastStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + WarningConsolidation &warnings) { try { @@ -432,7 +451,8 @@ ForecastStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolida } void -ForecastStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +ForecastStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); symbol_list.writeOutput("var_list_", output); @@ -462,7 +482,8 @@ RamseyModelStatement::RamseyModelStatement(OptionsList options_list_arg) : } void -RamseyModelStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +RamseyModelStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.ramsey_model_present = true; @@ -499,7 +520,8 @@ RamseyModelStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsol } void -RamseyModelStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +RamseyModelStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { // options_.ramsey_policy indicates that a Ramsey model is present in the *.mod file // this affects the computation of the steady state that uses a special algorithm @@ -535,13 +557,15 @@ RamseyConstraintsStatement::RamseyConstraintsStatement(const SymbolTable &symbol } void -RamseyConstraintsStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +RamseyConstraintsStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.ramsey_constraints_present = true; } void -RamseyConstraintsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +RamseyConstraintsStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "M_.ramsey_model_constraints = {" << endl; for (bool printed_something{false}; @@ -673,7 +697,8 @@ RamseyPolicyStatement::checkPass(ModFileStructure &mod_file_struct, WarningConso } void -RamseyPolicyStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +RamseyPolicyStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { // Ensure that order 3 implies k_order (#844) if (auto it = options_list.num_options.find("order"), @@ -710,7 +735,9 @@ EvaluatePlannerObjectiveStatement::EvaluatePlannerObjectiveStatement(OptionsList } void -EvaluatePlannerObjectiveStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +EvaluatePlannerObjectiveStatement::writeOutput(ostream &output, + [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); output << "oo_.planner_objective_value = evaluate_planner_objective(M_, options_, oo_);" << endl; @@ -790,7 +817,8 @@ DiscretionaryPolicyStatement::checkPass(ModFileStructure &mod_file_struct, Warni } void -DiscretionaryPolicyStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +DiscretionaryPolicyStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { // Ensure that order 3 implies k_order (#844) if (auto it = options_list.num_options.find("order"), @@ -827,7 +855,8 @@ OccbinSetupStatement::OccbinSetupStatement(OptionsList options_list_arg) : } void -OccbinSetupStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +OccbinSetupStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output, "options_occbin_"); output << "[M_, options_] = occbin.setup(M_, options_, options_occbin_);" << endl; @@ -851,7 +880,8 @@ OccbinSolverStatement::OccbinSolverStatement(OptionsList options_list_arg) : } void -OccbinSolverStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +OccbinSolverStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output, "options_.occbin"); output << "oo_ = occbin.solver(M_, oo_, options_);" << endl; @@ -875,7 +905,8 @@ OccbinWriteRegimesStatement::OccbinWriteRegimesStatement(OptionsList options_lis } void -OccbinWriteRegimesStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +OccbinWriteRegimesStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output, "options_.occbin"); output << "occbin.write_regimes_to_xls(oo_.occbin, M_, options_);" << endl; @@ -901,7 +932,8 @@ OccbinGraphStatement::OccbinGraphStatement(SymbolList symbol_list_arg, } void -OccbinGraphStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +OccbinGraphStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { symbol_list.writeOutput("var_list_", output); options_list.writeOutput(output, "options_occbin_"); @@ -1049,7 +1081,8 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli } void -EstimationStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +EstimationStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); @@ -1096,7 +1129,8 @@ DynareSensitivityStatement::DynareSensitivityStatement(OptionsList options_list_ } void -DynareSensitivityStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +DynareSensitivityStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { if (auto it = options_list.num_options.find("identification"); it != options_list.num_options.end() && it->second == "1") @@ -1109,7 +1143,8 @@ DynareSensitivityStatement::checkPass(ModFileStructure &mod_file_struct, Warning } void -DynareSensitivityStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +DynareSensitivityStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output, "options_gsa"); @@ -1150,7 +1185,8 @@ RplotStatement::RplotStatement(SymbolList symbol_list_arg, } void -RplotStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +RplotStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + WarningConsolidation &warnings) { try { @@ -1164,7 +1200,8 @@ RplotStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidatio } void -RplotStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +RplotStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { symbol_list.writeOutput("var_list_", output); output << "rplot(var_list_);" << endl; @@ -1183,7 +1220,8 @@ RplotStatement::writeJsonOutput(ostream &output) const } void -UnitRootVarsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +UnitRootVarsStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "options_.diffuse_filter = 1;" << endl << "options_.steadystate.nocheck = 1;" << endl; @@ -1202,7 +1240,8 @@ PeriodsStatement::PeriodsStatement(int periods_arg) : periods{periods_arg} } void -PeriodsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +PeriodsStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "options_.periods = " << periods << ";" << endl; } @@ -1223,7 +1262,8 @@ DsampleStatement::DsampleStatement(int val1_arg, int val2_arg) : val1{val1_arg}, } void -DsampleStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +DsampleStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { if (val2 < 0) output << "dsample(" << val1 << ");" << endl; @@ -1327,7 +1367,8 @@ EstimatedParamsStatement::EstimatedParamsStatement(vector esti } void -EstimatedParamsStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +EstimatedParamsStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { commonCheckPass(); @@ -1360,7 +1401,8 @@ EstimatedParamsStatement::checkPass(ModFileStructure &mod_file_struct, WarningCo } void -EstimatedParamsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +EstimatedParamsStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { string indent; if (!overwrite) @@ -1504,7 +1546,8 @@ EstimatedParamsInitStatement::EstimatedParamsInitStatement(vector osr_params_ } void -OsrParamsBoundsStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +OsrParamsBoundsStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { if (!mod_file_struct.osr_params_present) { @@ -2074,7 +2126,8 @@ OsrParamsBoundsStatement::checkPass(ModFileStructure &mod_file_struct, WarningCo } void -OsrParamsBoundsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +OsrParamsBoundsStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "M_.osr.param_bounds = [-inf(length(M_.osr.param_names), 1), inf(length(M_.osr.param_names), 1)];" << endl; @@ -2152,7 +2205,8 @@ OsrStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation } void -OsrStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +OsrStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { // Ensure that order 3 implies k_order (#844) if (auto it = options_list.num_options.find("order"), @@ -2193,13 +2247,15 @@ OptimWeightsStatement::OptimWeightsStatement(var_weights_t var_weights_arg, } void -OptimWeightsStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +OptimWeightsStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.optim_weights_present = true; } void -OptimWeightsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +OptimWeightsStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "%" << endl << "% OPTIM_WEIGHTS" << endl @@ -2265,7 +2321,8 @@ DynaSaveStatement::DynaSaveStatement(SymbolList symbol_list_arg, string filename } void -DynaSaveStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +DynaSaveStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + WarningConsolidation &warnings) { try { @@ -2279,7 +2336,8 @@ DynaSaveStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolida } void -DynaSaveStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +DynaSaveStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { symbol_list.writeOutput("var_list_", output); output << "dynasave('" << filename @@ -2308,7 +2366,8 @@ DynaTypeStatement::DynaTypeStatement(SymbolList symbol_list_arg, string filename } void -DynaTypeStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +DynaTypeStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + WarningConsolidation &warnings) { try { @@ -2322,7 +2381,8 @@ DynaTypeStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolida } void -DynaTypeStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +DynaTypeStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { symbol_list.writeOutput("var_list_", output); output << "dynatype('" << filename @@ -2350,7 +2410,8 @@ ModelComparisonStatement::ModelComparisonStatement(filename_list_t filename_list } void -ModelComparisonStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +ModelComparisonStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); @@ -2398,7 +2459,8 @@ PlannerObjectiveStatement::PlannerObjectiveStatement(const StaticModel &model_tr } void -PlannerObjectiveStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +PlannerObjectiveStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { assert(model_tree.equation_number() == 1); if (model_tree.exoPresentInEqs()) @@ -2425,7 +2487,8 @@ PlannerObjectiveStatement::computingPass(const ModFileStructure &mod_file_struct } void -PlannerObjectiveStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +PlannerObjectiveStatement::writeOutput(ostream &output, const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "M_.NNZDerivatives_objective = ["; for (int i=1; i < static_cast(model_tree.getNNZDerivatives().size()); i++) @@ -2458,13 +2521,15 @@ BVARDensityStatement::BVARDensityStatement(int maxnlags_arg, OptionsList options } void -BVARDensityStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +BVARDensityStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.bvar_present = true; } void -BVARDensityStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +BVARDensityStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); output << "bvar_density(" << maxnlags << ");" << endl; @@ -2489,13 +2554,15 @@ BVARForecastStatement::BVARForecastStatement(int nlags_arg, OptionsList options_ } void -BVARForecastStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +BVARForecastStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.bvar_present = true; } void -BVARForecastStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +BVARForecastStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); output << "bvar_forecast(" << nlags << ");" << endl; @@ -2519,13 +2586,15 @@ SBVARStatement::SBVARStatement(OptionsList options_list_arg) : } void -SBVARStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +SBVARStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.bvar_present = true; } void -SBVARStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +SBVARStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); output << "sbvar(M_,options_);" << endl; @@ -2549,7 +2618,8 @@ MSSBVAREstimationStatement::MSSBVAREstimationStatement(OptionsList options_list_ } void -MSSBVAREstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +MSSBVAREstimationStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.bvar_present = true; @@ -2564,7 +2634,8 @@ MSSBVAREstimationStatement::checkPass(ModFileStructure &mod_file_struct, Warning } void -MSSBVAREstimationStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +MSSBVAREstimationStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "options_ = initialize_ms_sbvar_options(M_, options_);" << endl << "options_.datafile = '';" << endl; @@ -2590,13 +2661,15 @@ MSSBVARSimulationStatement::MSSBVARSimulationStatement(OptionsList options_list_ } void -MSSBVARSimulationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +MSSBVARSimulationStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.bvar_present = true; } void -MSSBVARSimulationStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +MSSBVARSimulationStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "options_ = initialize_ms_sbvar_options(M_, options_);" << endl; options_list.writeOutput(output); @@ -2628,13 +2701,15 @@ MSSBVARComputeMDDStatement::MSSBVARComputeMDDStatement(OptionsList options_list_ } void -MSSBVARComputeMDDStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +MSSBVARComputeMDDStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.bvar_present = true; } void -MSSBVARComputeMDDStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +MSSBVARComputeMDDStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "options_ = initialize_ms_sbvar_options(M_, options_);" << endl; options_list.writeOutput(output); @@ -2659,7 +2734,8 @@ MSSBVARComputeProbabilitiesStatement::MSSBVARComputeProbabilitiesStatement(Optio } void -MSSBVARComputeProbabilitiesStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +MSSBVARComputeProbabilitiesStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.bvar_present = true; @@ -2673,7 +2749,9 @@ MSSBVARComputeProbabilitiesStatement::checkPass(ModFileStructure &mod_file_struc } void -MSSBVARComputeProbabilitiesStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +MSSBVARComputeProbabilitiesStatement::writeOutput(ostream &output, + [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "options_ = initialize_ms_sbvar_options(M_, options_);" << endl; options_list.writeOutput(output); @@ -2729,7 +2807,8 @@ MSSBVARIrfStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli } void -MSSBVARIrfStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +MSSBVARIrfStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "options_ = initialize_ms_sbvar_options(M_, options_);" << endl; symbol_list.writeOutput("var_list_", output); @@ -2760,7 +2839,8 @@ MSSBVARForecastStatement::MSSBVARForecastStatement(OptionsList options_list_arg) } void -MSSBVARForecastStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +MSSBVARForecastStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.bvar_present = true; @@ -2773,7 +2853,8 @@ MSSBVARForecastStatement::checkPass(ModFileStructure &mod_file_struct, WarningCo } void -MSSBVARForecastStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +MSSBVARForecastStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "options_ = initialize_ms_sbvar_options(M_, options_);" << endl; options_list.writeOutput(output); @@ -2798,7 +2879,8 @@ MSSBVARVarianceDecompositionStatement::MSSBVARVarianceDecompositionStatement(Opt } void -MSSBVARVarianceDecompositionStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +MSSBVARVarianceDecompositionStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.bvar_present = true; @@ -2816,7 +2898,9 @@ MSSBVARVarianceDecompositionStatement::checkPass(ModFileStructure &mod_file_stru } void -MSSBVARVarianceDecompositionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +MSSBVARVarianceDecompositionStatement::writeOutput(ostream &output, + [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "options_ = initialize_ms_sbvar_options(M_, options_);" << endl; options_list.writeOutput(output); @@ -2847,7 +2931,8 @@ IdentificationStatement::IdentificationStatement(OptionsList options_list_arg) } void -IdentificationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +IdentificationStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.identification_present = true; @@ -2869,7 +2954,8 @@ IdentificationStatement::checkPass(ModFileStructure &mod_file_struct, WarningCon } void -IdentificationStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +IdentificationStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output, "options_ident"); @@ -2909,7 +2995,8 @@ WriteLatexDynamicModelStatement::WriteLatexDynamicModelStatement(const DynamicMo } void -WriteLatexDynamicModelStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +WriteLatexDynamicModelStatement::writeOutput([[maybe_unused]] ostream &output, const string &basename, + [[maybe_unused]] bool minimal_workspace) const { dynamic_model.writeLatexFile(basename, write_equation_tags); } @@ -2927,7 +3014,8 @@ WriteLatexStaticModelStatement::WriteLatexStaticModelStatement(const StaticModel } void -WriteLatexStaticModelStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +WriteLatexStaticModelStatement::writeOutput([[maybe_unused]] ostream &output, const string &basename, + [[maybe_unused]] bool minimal_workspace) const { static_model.writeLatexFile(basename, write_equation_tags); } @@ -2945,7 +3033,8 @@ WriteLatexOriginalModelStatement::WriteLatexOriginalModelStatement(const Dynamic } void -WriteLatexOriginalModelStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +WriteLatexOriginalModelStatement::writeOutput([[maybe_unused]] ostream &output, const string &basename, + [[maybe_unused]] bool minimal_workspace) const { original_model.writeLatexOriginalFile(basename, write_equation_tags); } @@ -2962,13 +3051,16 @@ WriteLatexSteadyStateModelStatement::WriteLatexSteadyStateModelStatement(const S } void -WriteLatexSteadyStateModelStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +WriteLatexSteadyStateModelStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.write_latex_steady_state_model_present = true; } void -WriteLatexSteadyStateModelStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +WriteLatexSteadyStateModelStatement::writeOutput([[maybe_unused]] ostream &output, + const string &basename, + [[maybe_unused]] bool minimal_workspace) const { steady_state_model.writeLatexSteadyStateFile(basename); } @@ -3007,7 +3099,8 @@ ShockDecompositionStatement::checkPass(ModFileStructure &mod_file_struct, Warnin } void -ShockDecompositionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +ShockDecompositionStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); symbol_list.writeOutput("var_list_", output); @@ -3059,7 +3152,9 @@ RealtimeShockDecompositionStatement::checkPass(ModFileStructure &mod_file_struct } void -RealtimeShockDecompositionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +RealtimeShockDecompositionStatement::writeOutput(ostream &output, + [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); symbol_list.writeOutput("var_list_", output); @@ -3093,7 +3188,8 @@ PlotShockDecompositionStatement::PlotShockDecompositionStatement(SymbolList symb } void -PlotShockDecompositionStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +PlotShockDecompositionStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + WarningConsolidation &warnings) { try { @@ -3107,7 +3203,8 @@ PlotShockDecompositionStatement::checkPass(ModFileStructure &mod_file_struct, Wa } void -PlotShockDecompositionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +PlotShockDecompositionStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "options_ = set_default_plot_shock_decomposition_options(options_);" << endl; options_list.writeOutput(output); @@ -3160,7 +3257,9 @@ InitialConditionDecompositionStatement::checkPass(ModFileStructure &mod_file_str } void -InitialConditionDecompositionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +InitialConditionDecompositionStatement::writeOutput(ostream &output, + [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "options_ = set_default_initial_condition_decomposition_options(options_);" << endl; options_list.writeOutput(output); @@ -3193,7 +3292,7 @@ SqueezeShockDecompositionStatement::SqueezeShockDecompositionStatement(SymbolLis } void -SqueezeShockDecompositionStatement::checkPass(ModFileStructure &mod_file_struct, +SqueezeShockDecompositionStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, WarningConsolidation &warnings) { try @@ -3208,7 +3307,9 @@ SqueezeShockDecompositionStatement::checkPass(ModFileStructure &mod_file_struct, } void -SqueezeShockDecompositionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +SqueezeShockDecompositionStatement::writeOutput(ostream &output, + [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { if (symbol_list.empty()) output << "oo_ = squeeze_shock_decomposition(M_, oo_, options_);" << endl; @@ -3237,7 +3338,8 @@ ConditionalForecastStatement::ConditionalForecastStatement(OptionsList options_l } void -ConditionalForecastStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +ConditionalForecastStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { if (!options_list.string_options.contains("parameter_set")) { @@ -3247,7 +3349,8 @@ ConditionalForecastStatement::checkPass(ModFileStructure &mod_file_struct, Warni } void -ConditionalForecastStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +ConditionalForecastStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output, "options_cond_fcst_"); output << "imcforecast(constrained_paths_, constrained_vars_, options_cond_fcst_);" << endl; @@ -3275,7 +3378,7 @@ PlotConditionalForecastStatement::PlotConditionalForecastStatement(optional } void -PlotConditionalForecastStatement::checkPass(ModFileStructure &mod_file_struct, +PlotConditionalForecastStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, WarningConsolidation &warnings) { try @@ -3290,7 +3393,8 @@ PlotConditionalForecastStatement::checkPass(ModFileStructure &mod_file_struct, } void -PlotConditionalForecastStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +PlotConditionalForecastStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { symbol_list.writeOutput("var_list_", output); if (periods) @@ -3337,7 +3441,8 @@ SvarIdentificationStatement::getMaxLag() const } void -SvarIdentificationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +SvarIdentificationStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { // no equations OK with Svar Identification mod_file_struct.bvar_present = true; @@ -3358,7 +3463,8 @@ SvarIdentificationStatement::checkPass(ModFileStructure &mod_file_struct, Warnin } void -SvarIdentificationStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +SvarIdentificationStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { assert(!(upper_cholesky_present && lower_cholesky_present)); output << "%" << endl @@ -3517,7 +3623,8 @@ MarkovSwitchingStatement::MarkovSwitchingStatement(OptionsList options_list_arg) } void -MarkovSwitchingStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +MarkovSwitchingStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { auto itChain = options_list.num_options.find("ms.chain"); assert(itChain != options_list.num_options.end()); @@ -3592,7 +3699,8 @@ MarkovSwitchingStatement::checkPass(ModFileStructure &mod_file_struct, WarningCo } void -MarkovSwitchingStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +MarkovSwitchingStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { auto itChain = options_list.num_options.find("ms.chain"); assert(itChain != options_list.num_options.end()); @@ -3671,7 +3779,8 @@ SvarStatement::SvarStatement(OptionsList options_list_arg) : } void -SvarStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +SvarStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { bool has_coefficients = options_list.string_options.contains("ms.coefficients"), has_variances = options_list.string_options.contains("ms.variances"), @@ -3682,7 +3791,8 @@ SvarStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation } void -SvarStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +SvarStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { auto it = options_list.num_options.find("ms.chain"); assert(it != options_list.num_options.end()); @@ -3729,7 +3839,9 @@ SvarStatement::writeJsonOutput(ostream &output) const } void -SvarGlobalIdentificationCheckStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +SvarGlobalIdentificationCheckStatement::writeOutput(ostream &output, + [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "svar_global_identification_check(options_);" << std::endl; } @@ -3746,7 +3858,8 @@ SetTimeStatement::SetTimeStatement(OptionsList options_list_arg) : } void -SetTimeStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +SetTimeStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); } @@ -3769,7 +3882,8 @@ EstimationDataStatement::EstimationDataStatement(OptionsList options_list_arg) : } void -EstimationDataStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +EstimationDataStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.estimation_data_statement_present = true; @@ -3796,7 +3910,8 @@ EstimationDataStatement::checkPass(ModFileStructure &mod_file_struct, WarningCon } void -EstimationDataStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +EstimationDataStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output, "options_.dataset"); } @@ -3825,7 +3940,9 @@ SubsamplesStatement::SubsamplesStatement(string name1_arg, } void -SubsamplesStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +SubsamplesStatement::writeOutput(ostream &output, + [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "subsamples_indx = get_new_or_existing_ei_index('subsamples_index', '" << name1 << "','" << name2 << "');" << endl @@ -3930,7 +4047,8 @@ SubsamplesEqualStatement::SubsamplesEqualStatement(string to_name1_arg, } void -SubsamplesEqualStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +SubsamplesEqualStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "subsamples_to_indx = get_new_or_existing_ei_index('subsamples_index', '" << to_name1 << "','" << to_name2 << "');" << endl @@ -4010,7 +4128,8 @@ JointPriorStatement::JointPriorStatement(vector joint_parameters_arg, } void -JointPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +JointPriorStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { if (joint_parameters.size() < 2) { @@ -4044,7 +4163,8 @@ JointPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli } void -JointPriorStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +JointPriorStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { for (const auto &joint_parameter : joint_parameters) output << "eifind = get_new_or_existing_ei_index('joint_parameter_prior_index', '" @@ -4202,7 +4322,8 @@ BasicPriorStatement::BasicPriorStatement(string name_arg, } void -BasicPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +BasicPriorStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { if (prior_shape == PriorDistributions::noShape) { @@ -4369,7 +4490,8 @@ PriorStatement::PriorStatement(string name_arg, } void -PriorStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +PriorStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { string lhs_field = "estimation_info.parameter(eifind)"; output << "eifind = get_new_or_existing_ei_index('parameter_prior_index', '" @@ -4398,7 +4520,8 @@ StdPriorStatement::StdPriorStatement(string name_arg, } void -StdPriorStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +StdPriorStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { string lhs_field; get_base_name(symbol_table.getType(name), lhs_field); @@ -4444,7 +4567,8 @@ CorrPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolid } void -CorrPriorStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +CorrPriorStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { string lhs_field; get_base_name(symbol_table.getType(name), lhs_field); @@ -4489,7 +4613,8 @@ PriorEqualStatement::PriorEqualStatement(string to_declaration_type_arg, } void -PriorEqualStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +PriorEqualStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { if ((to_declaration_type != "par" && to_declaration_type != "std" && to_declaration_type != "corr") || (from_declaration_type != "par" && from_declaration_type != "std" && from_declaration_type != "corr")) @@ -4509,7 +4634,8 @@ PriorEqualStatement::get_base_name(const SymbolType symb_type, string &lhs_field } void -PriorEqualStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +PriorEqualStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { string lhs_field, rhs_field; @@ -4661,7 +4787,8 @@ OptionsStatement::OptionsStatement(string name_arg, } void -OptionsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +OptionsStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { string lhs_field = "estimation_info.parameter(eifind)"; output << "eifind = get_new_or_existing_ei_index('parameter_options_index', '" @@ -4688,7 +4815,8 @@ StdOptionsStatement::StdOptionsStatement(string name_arg, } void -StdOptionsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +StdOptionsStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { string lhs_field; get_base_name(symbol_table.getType(name), lhs_field); @@ -4719,7 +4847,8 @@ CorrOptionsStatement::CorrOptionsStatement(string name_arg1, string name_arg2, } void -CorrOptionsStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +CorrOptionsStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { if (symbol_table.getType(name) != symbol_table.getType(name1)) { @@ -4731,7 +4860,8 @@ CorrOptionsStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsol } void -CorrOptionsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +CorrOptionsStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { string lhs_field; get_base_name(symbol_table.getType(name), lhs_field); @@ -4776,7 +4906,8 @@ OptionsEqualStatement::OptionsEqualStatement(string to_declaration_type_arg, } void -OptionsEqualStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +OptionsEqualStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { if ((to_declaration_type != "par" && to_declaration_type != "std" && to_declaration_type != "corr") || (from_declaration_type != "par" && from_declaration_type != "std" && from_declaration_type != "corr")) @@ -4811,7 +4942,8 @@ OptionsEqualStatement::get_base_name(const SymbolType symb_type, string &lhs_fie } void -OptionsEqualStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +OptionsEqualStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { string lhs_field, rhs_field; @@ -4896,7 +5028,8 @@ CalibSmootherStatement::checkPass(ModFileStructure &mod_file_struct, WarningCons } void -CalibSmootherStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +CalibSmootherStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); if (!options_list.string_options.contains("parameter_set")) @@ -4930,7 +5063,8 @@ ExtendedPathStatement::ExtendedPathStatement(OptionsList options_list_arg) } void -ExtendedPathStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +ExtendedPathStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.extended_path_present = true; @@ -4942,7 +5076,8 @@ ExtendedPathStatement::checkPass(ModFileStructure &mod_file_struct, WarningConso } void -ExtendedPathStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +ExtendedPathStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { // Beware: options do not have the same name in the interface and in the M code... @@ -4967,7 +5102,8 @@ ExtendedPathStatement::writeJsonOutput(ostream &output) const } void -ModelDiagnosticsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +ModelDiagnosticsStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "model_diagnostics(M_,options_,oo_);" << endl; } @@ -4984,7 +5120,8 @@ Smoother2histvalStatement::Smoother2histvalStatement(OptionsList options_list_ar } void -Smoother2histvalStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +Smoother2histvalStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output, "options_smoother2histval"); output << "smoother2histval(options_smoother2histval);" << endl; @@ -5008,7 +5145,8 @@ MethodOfMomentsStatement::MethodOfMomentsStatement(OptionsList options_list_arg) } void -MethodOfMomentsStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +MethodOfMomentsStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.mom_estimation_present = true; // Fill in option_order of mod_file_struct @@ -5062,7 +5200,8 @@ MethodOfMomentsStatement::checkPass(ModFileStructure &mod_file_struct, WarningCo } void -MethodOfMomentsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +MethodOfMomentsStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output, "options_mom_"); @@ -5092,7 +5231,8 @@ GenerateIRFsStatement::GenerateIRFsStatement(OptionsList options_list_arg, } void -GenerateIRFsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +GenerateIRFsStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); @@ -5154,7 +5294,8 @@ MatchedMomentsStatement::MatchedMomentsStatement(const SymbolTable &symbol_table } void -MatchedMomentsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +MatchedMomentsStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "M_.matched_moments = {" << endl; for (const auto &[symb_ids, lags, powers] : moments) @@ -5218,7 +5359,8 @@ OccbinConstraintsStatement::OccbinConstraintsStatement(const DataTree &data_tree } void -OccbinConstraintsStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +OccbinConstraintsStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { if (mod_file_struct.occbin_constraints_present) { @@ -5234,7 +5376,8 @@ OccbinConstraintsStatement::checkPass(ModFileStructure &mod_file_struct, Warning } void -OccbinConstraintsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +OccbinConstraintsStatement::writeOutput(ostream &output, const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "M_.occbin.constraint_nbr = " << constraints.size() << ';' << endl << "M_.occbin.pswitch = [" << endl; @@ -5342,7 +5485,8 @@ ResidStatement::ResidStatement(OptionsList options_list_arg) : } void -ResidStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +ResidStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output, "options_resid_"); output << "resid(options_resid_);" << endl; diff --git a/src/DataTree.cc b/src/DataTree.cc index 7044d98e..ec0590d4 100644 --- a/src/DataTree.cc +++ b/src/DataTree.cc @@ -804,36 +804,36 @@ DataTree::isSymbolUsed(int symb_id) const } int -DataTree::getDerivID(int symb_id, int lag) const noexcept(false) +DataTree::getDerivID([[maybe_unused]] int symb_id, [[maybe_unused]] int lag) const noexcept(false) { throw UnknownDerivIDException(); } SymbolType -DataTree::getTypeByDerivID(int deriv_id) const noexcept(false) +DataTree::getTypeByDerivID([[maybe_unused]] int deriv_id) const noexcept(false) { throw UnknownDerivIDException(); } int -DataTree::getLagByDerivID(int deriv_id) const noexcept(false) +DataTree::getLagByDerivID([[maybe_unused]] int deriv_id) const noexcept(false) { throw UnknownDerivIDException(); } int -DataTree::getSymbIDByDerivID(int deriv_id) const noexcept(false) +DataTree::getSymbIDByDerivID([[maybe_unused]] int deriv_id) const noexcept(false) { throw UnknownDerivIDException(); } void -DataTree::addAllParamDerivId(set &deriv_id_set) +DataTree::addAllParamDerivId([[maybe_unused]] set &deriv_id_set) { } int -DataTree::getDynJacobianCol(int deriv_id) const noexcept(false) +DataTree::getDynJacobianCol([[maybe_unused]] int deriv_id) const noexcept(false) { throw UnknownDerivIDException(); } diff --git a/src/ExprNode.cc b/src/ExprNode.cc index de9fabb2..e726ac92 100644 --- a/src/ExprNode.cc +++ b/src/ExprNode.cc @@ -54,35 +54,38 @@ ExprNode::getDerivative(int deriv_id) } int -ExprNode::precedence(ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms) const +ExprNode::precedence([[maybe_unused]] ExprNodeOutputType output_type, + [[maybe_unused]] const temporary_terms_t &temporary_terms) const { // For a constant, a variable, or a unary op, the precedence is maximal return 100; } int -ExprNode::precedenceJson(const temporary_terms_t &temporary_terms) const +ExprNode::precedenceJson([[maybe_unused]] const temporary_terms_t &temporary_terms) const { // For a constant, a variable, or a unary op, the precedence is maximal return 100; } int -ExprNode::cost(int cost, bool is_matlab) const +ExprNode::cost([[maybe_unused]] int cost, [[maybe_unused]] bool is_matlab) const { // For a terminal node, the cost is null return 0; } int -ExprNode::cost(const vector> &blocks_temporary_terms, bool is_matlab) const +ExprNode::cost([[maybe_unused]] const vector> &blocks_temporary_terms, + [[maybe_unused]] bool is_matlab) const { // For a terminal node, the cost is null return 0; } int -ExprNode::cost(const map, temporary_terms_t> &temp_terms_map, bool is_matlab) const +ExprNode::cost([[maybe_unused]] const map, temporary_terms_t> &temp_terms_map, + [[maybe_unused]] bool is_matlab) const { // For a terminal node, the cost is null return 0; @@ -158,17 +161,18 @@ ExprNode::collectEndogenous(set> &result) const } void -ExprNode::computeTemporaryTerms(const pair &derivOrder, - map, temporary_terms_t> &temp_terms_map, - map>> &reference_count, - bool is_matlab) const +ExprNode::computeTemporaryTerms([[maybe_unused]] const pair &derivOrder, + [[maybe_unused]] map, temporary_terms_t> &temp_terms_map, + [[maybe_unused]] map>> &reference_count, + [[maybe_unused]] bool is_matlab) const { // Nothing to do for a terminal node } void -ExprNode::computeBlockTemporaryTerms(int blk, int eq, vector> &blocks_temporary_terms, - map> &reference_count) const +ExprNode::computeBlockTemporaryTerms([[maybe_unused]] int blk, [[maybe_unused]] int eq, + [[maybe_unused]] vector> &blocks_temporary_terms, + [[maybe_unused]] map> &reference_count) const { // Nothing to do for a terminal node } @@ -192,28 +196,32 @@ ExprNode::writeOutput(ostream &output, ExprNodeOutputType output_type, const tem } void -ExprNode::writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type, - const temporary_terms_t &temporary_terms, - const temporary_terms_idxs_t &temporary_terms_idxs, - deriv_node_temp_terms_t &tef_terms) const +ExprNode::writeExternalFunctionOutput([[maybe_unused]] ostream &output, + [[maybe_unused]] ExprNodeOutputType output_type, + [[maybe_unused]] const temporary_terms_t &temporary_terms, + [[maybe_unused]] const temporary_terms_idxs_t &temporary_terms_idxs, + [[maybe_unused]] deriv_node_temp_terms_t &tef_terms) const { // Nothing to do } void -ExprNode::writeJsonExternalFunctionOutput(vector &efout, - const temporary_terms_t &temporary_terms, - deriv_node_temp_terms_t &tef_terms, - bool isdynamic) const +ExprNode::writeJsonExternalFunctionOutput([[maybe_unused]] vector &efout, + [[maybe_unused]] const temporary_terms_t &temporary_terms, + [[maybe_unused]] deriv_node_temp_terms_t &tef_terms, + [[maybe_unused]] bool isdynamic) const { // Nothing to do } void -ExprNode::writeBytecodeExternalFunctionOutput(BytecodeWriter &code_file, bool lhs_rhs, - const temporary_terms_t &temporary_terms, - const temporary_terms_idxs_t &temporary_terms_idxs, bool dynamic, bool steady_dynamic, - deriv_node_temp_terms_t &tef_terms) const +ExprNode::writeBytecodeExternalFunctionOutput([[maybe_unused]] BytecodeWriter &code_file, + [[maybe_unused]] bool lhs_rhs, + [[maybe_unused]] const temporary_terms_t &temporary_terms, + [[maybe_unused]] const temporary_terms_idxs_t &temporary_terms_idxs, + [[maybe_unused]] bool dynamic, + [[maybe_unused]] bool steady_dynamic, + [[maybe_unused]] deriv_node_temp_terms_t &tef_terms) const { // Nothing to do } @@ -289,13 +297,14 @@ ExprNode::createExoLeadAuxiliaryVarForMyself(subst_table_t &subst_table, vector< } bool -ExprNode::isNumConstNodeEqualTo(double value) const +ExprNode::isNumConstNodeEqualTo([[maybe_unused]] double value) const { return false; } bool -ExprNode::isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const +ExprNode::isVariableNodeEqualTo([[maybe_unused]] SymbolType type_arg, [[maybe_unused]] int variable_id, + [[maybe_unused]] int lag_arg) const { return false; } @@ -388,7 +397,9 @@ ExprNode::fillErrorCorrectionRow(int eqn, } void -ExprNode::matchMatchedMoment(vector &symb_ids, vector &lags, vector &powers) const +ExprNode::matchMatchedMoment([[maybe_unused]] vector &symb_ids, + [[maybe_unused]] vector &lags, + [[maybe_unused]] vector &powers) const { throw MatchFailureException{"Unsupported expression"}; } @@ -433,7 +444,7 @@ NumConstNode::prepareForDerivation() } expr_t -NumConstNode::computeDerivative(int deriv_id) +NumConstNode::computeDerivative([[maybe_unused]] int deriv_id) { return datatree.Zero; } @@ -442,7 +453,7 @@ void NumConstNode::writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, - const deriv_node_temp_terms_t &tef_terms) const + [[maybe_unused]] const deriv_node_temp_terms_t &tef_terms) const { if (!checkIfTemporaryTermThenWrite(output, output_type, temporary_terms, temporary_terms_idxs)) output << datatree.num_constants.get(id); @@ -458,8 +469,8 @@ NumConstNode::writeJsonAST(ostream &output) const void NumConstNode::writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, - const deriv_node_temp_terms_t &tef_terms, - bool isdynamic) const + [[maybe_unused]] const deriv_node_temp_terms_t &tef_terms, + [[maybe_unused]] bool isdynamic) const { if (temporary_terms.contains(const_cast(this))) output << "T" << idx; @@ -474,47 +485,52 @@ NumConstNode::containsExternalFunction() const } double -NumConstNode::eval(const eval_context_t &eval_context) const noexcept(false) +NumConstNode::eval([[maybe_unused]] const eval_context_t &eval_context) const noexcept(false) { return datatree.num_constants.getDouble(id); } void -NumConstNode::writeBytecodeOutput(BytecodeWriter &code_file, bool lhs_rhs, +NumConstNode::writeBytecodeOutput(BytecodeWriter &code_file, [[maybe_unused]] bool lhs_rhs, const temporary_terms_t &temporary_terms, - const temporary_terms_idxs_t &temporary_terms_idxs, bool dynamic, bool steady_dynamic, - const deriv_node_temp_terms_t &tef_terms) const + const temporary_terms_idxs_t &temporary_terms_idxs, bool dynamic, + [[maybe_unused]] bool steady_dynamic, + [[maybe_unused]] const deriv_node_temp_terms_t &tef_terms) const { if (!checkIfTemporaryTermThenWriteBytecode(code_file, temporary_terms, temporary_terms_idxs, dynamic)) code_file << FLDC_{datatree.num_constants.getDouble(id)}; } void -NumConstNode::collectVARLHSVariable(set &result) const +NumConstNode::collectVARLHSVariable([[maybe_unused]] set &result) const { cerr << "ERROR: you can only have variables or unary ops on LHS of VAR" << endl; exit(EXIT_FAILURE); } void -NumConstNode::collectDynamicVariables(SymbolType type_arg, set> &result) const +NumConstNode::collectDynamicVariables([[maybe_unused]] SymbolType type_arg, + [[maybe_unused]] set> &result) const { } void -NumConstNode::computeSubExprContainingVariable(int symb_id, int lag, set &contain_var) const +NumConstNode::computeSubExprContainingVariable([[maybe_unused]] int symb_id, [[maybe_unused]] int lag, + [[maybe_unused]] set &contain_var) const { } BinaryOpNode * -NumConstNode::normalizeEquationHelper(const set &contain_var, expr_t rhs) const +NumConstNode::normalizeEquationHelper([[maybe_unused]] const set &contain_var, + [[maybe_unused]] expr_t rhs) const { cerr << "NumConstNode::normalizeEquation: this should not happen" << endl; exit(EXIT_FAILURE); } expr_t -NumConstNode::getChainRuleDerivative(int deriv_id, const map &recursive_variables) +NumConstNode::getChainRuleDerivative([[maybe_unused]] int deriv_id, + [[maybe_unused]] const map &recursive_variables) { return datatree.Zero; } @@ -526,7 +542,7 @@ NumConstNode::toStatic(DataTree &static_datatree) const } void -NumConstNode::computeXrefs(EquationInfo &ei) const +NumConstNode::computeXrefs([[maybe_unused]] EquationInfo &ei) const { } @@ -585,13 +601,13 @@ NumConstNode::undiff() const } int -NumConstNode::VarMaxLag(const set &lhs_lag_equiv) const +NumConstNode::VarMaxLag([[maybe_unused]] const set &lhs_lag_equiv) const { return 0; } expr_t -NumConstNode::decreaseLeadsLags(int n) const +NumConstNode::decreaseLeadsLags([[maybe_unused]] int n) const { return const_cast(this); } @@ -603,31 +619,39 @@ NumConstNode::decreaseLeadsLagsPredeterminedVariables() const } expr_t -NumConstNode::substituteEndoLeadGreaterThanTwo(subst_table_t &subst_table, vector &neweqs, bool deterministic_model) const +NumConstNode::substituteEndoLeadGreaterThanTwo([[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs, + [[maybe_unused]] bool deterministic_model) const { return const_cast(this); } expr_t -NumConstNode::substituteEndoLagGreaterThanTwo(subst_table_t &subst_table, vector &neweqs) const +NumConstNode::substituteEndoLagGreaterThanTwo([[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs) const { return const_cast(this); } expr_t -NumConstNode::substituteExoLead(subst_table_t &subst_table, vector &neweqs, bool deterministic_model) const +NumConstNode::substituteExoLead([[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs, + [[maybe_unused]] bool deterministic_model) const { return const_cast(this); } expr_t -NumConstNode::substituteExoLag(subst_table_t &subst_table, vector &neweqs) const +NumConstNode::substituteExoLag([[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs) const { return const_cast(this); } expr_t -NumConstNode::substituteExpectation(subst_table_t &subst_table, vector &neweqs, bool partial_information_model) const +NumConstNode::substituteExpectation([[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs, + [[maybe_unused]] bool partial_information_model) const { return const_cast(this); } @@ -645,53 +669,61 @@ NumConstNode::substituteModelLocalVariables() const } expr_t -NumConstNode::substituteVarExpectation(const map &subst_table) const +NumConstNode::substituteVarExpectation([[maybe_unused]] const map &subst_table) const { return const_cast(this); } void -NumConstNode::findDiffNodes(lag_equivalence_table_t &nodes) const +NumConstNode::findDiffNodes([[maybe_unused]] lag_equivalence_table_t &nodes) const { } void -NumConstNode::findUnaryOpNodesForAuxVarCreation(lag_equivalence_table_t &nodes) const +NumConstNode::findUnaryOpNodesForAuxVarCreation([[maybe_unused]] lag_equivalence_table_t &nodes) const { } optional -NumConstNode::findTargetVariable(int lhs_symb_id) const +NumConstNode::findTargetVariable([[maybe_unused]] int lhs_symb_id) const { return nullopt; } expr_t -NumConstNode::substituteDiff(const lag_equivalence_table_t &nodes, subst_table_t &subst_table, vector &neweqs) const +NumConstNode::substituteDiff([[maybe_unused]] const lag_equivalence_table_t &nodes, + [[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs) const { return const_cast(this); } expr_t -NumConstNode::substituteUnaryOpNodes(const lag_equivalence_table_t &nodes, subst_table_t &subst_table, vector &neweqs) const +NumConstNode::substituteUnaryOpNodes([[maybe_unused]] const lag_equivalence_table_t &nodes, + [[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs) const { return const_cast(this); } expr_t -NumConstNode::substitutePacExpectation(const string &name, expr_t subexpr) +NumConstNode::substitutePacExpectation([[maybe_unused]] const string &name, + [[maybe_unused]] expr_t subexpr) { return const_cast(this); } expr_t -NumConstNode::substitutePacTargetNonstationary(const string &name, expr_t subexpr) +NumConstNode::substitutePacTargetNonstationary([[maybe_unused]] const string &name, + [[maybe_unused]] expr_t subexpr) { return const_cast(this); } expr_t -NumConstNode::differentiateForwardVars(const vector &subset, subst_table_t &subst_table, vector &neweqs) const +NumConstNode::differentiateForwardVars([[maybe_unused]] const vector &subset, + [[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs) const { return const_cast(this); } @@ -706,19 +738,21 @@ NumConstNode::isNumConstNodeEqualTo(double value) const } bool -NumConstNode::isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const +NumConstNode::isVariableNodeEqualTo([[maybe_unused]] SymbolType type_arg, + [[maybe_unused]] int variable_id, + [[maybe_unused]] int lag_arg) const { return false; } bool -NumConstNode::containsPacExpectation(const string &pac_model_name) const +NumConstNode::containsPacExpectation([[maybe_unused]] const string &pac_model_name) const { return false; } bool -NumConstNode::containsPacTargetNonstationary(const string &pac_model_name) const +NumConstNode::containsPacTargetNonstationary([[maybe_unused]] const string &pac_model_name) const { return false; } @@ -730,13 +764,14 @@ NumConstNode::replaceTrendVar() const } expr_t -NumConstNode::detrend(int symb_id, bool log_trend, expr_t trend) const +NumConstNode::detrend([[maybe_unused]] int symb_id, [[maybe_unused]] bool log_trend, + [[maybe_unused]] expr_t trend) const { return const_cast(this); } expr_t -NumConstNode::removeTrendLeadLag(const map &trend_symbols_map) const +NumConstNode::removeTrendLeadLag([[maybe_unused]] const map &trend_symbols_map) const { return const_cast(this); } @@ -760,13 +795,14 @@ NumConstNode::substituteStaticAuxiliaryVariable() const } expr_t -NumConstNode::replaceVarsInEquation(map &table) const +NumConstNode::replaceVarsInEquation([[maybe_unused]] map &table) const { return const_cast(this); } expr_t -NumConstNode::substituteLogTransform(int orig_symb_id, int aux_symb_id) const +NumConstNode::substituteLogTransform([[maybe_unused]] int orig_symb_id, + [[maybe_unused]] int aux_symb_id) const { return const_cast(this); } @@ -928,7 +964,7 @@ VariableNode::writeJsonAST(ostream &output) const void VariableNode::writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, - const deriv_node_temp_terms_t &tef_terms, + [[maybe_unused]] const deriv_node_temp_terms_t &tef_terms, bool isdynamic) const { if (temporary_terms.contains(const_cast(this))) @@ -1858,7 +1894,7 @@ VariableNode::differentiateForwardVars(const vector &subset, subst_table } bool -VariableNode::isNumConstNodeEqualTo(double value) const +VariableNode::isNumConstNodeEqualTo([[maybe_unused]] double value) const { return false; } @@ -3726,13 +3762,15 @@ UnaryOpNode::differentiateForwardVars(const vector &subset, subst_table_ } bool -UnaryOpNode::isNumConstNodeEqualTo(double value) const +UnaryOpNode::isNumConstNodeEqualTo([[maybe_unused]] double value) const { return false; } bool -UnaryOpNode::isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const +UnaryOpNode::isVariableNodeEqualTo([[maybe_unused]] SymbolType type_arg, + [[maybe_unused]] int variable_id, + [[maybe_unused]] int lag_arg) const { return false; } @@ -4733,7 +4771,7 @@ BinaryOpNode::VarMaxLag(const set &lhs_lag_equiv) const } void -BinaryOpNode::collectVARLHSVariable(set &result) const +BinaryOpNode::collectVARLHSVariable([[maybe_unused]] set &result) const { cerr << "ERROR: you can only have variables or unary ops on LHS of VAR" << endl; exit(EXIT_FAILURE); @@ -5214,13 +5252,15 @@ BinaryOpNode::addMultipliersToConstraints(int i) } bool -BinaryOpNode::isNumConstNodeEqualTo(double value) const +BinaryOpNode::isNumConstNodeEqualTo([[maybe_unused]] double value) const { return false; } bool -BinaryOpNode::isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const +BinaryOpNode::isVariableNodeEqualTo([[maybe_unused]] SymbolType type_arg, + [[maybe_unused]] int variable_id, + [[maybe_unused]] int lag_arg) const { return false; } @@ -5802,7 +5842,8 @@ TrinaryOpNode::computeDerivative(int deriv_id) } int -TrinaryOpNode::precedence(ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms) const +TrinaryOpNode::precedence([[maybe_unused]] ExprNodeOutputType output_type, + const temporary_terms_t &temporary_terms) const { // A temporary term behaves as a variable if (temporary_terms.contains(const_cast(this))) @@ -6150,7 +6191,7 @@ TrinaryOpNode::writeBytecodeExternalFunctionOutput(BytecodeWriter &code_file, bo } void -TrinaryOpNode::collectVARLHSVariable(set &result) const +TrinaryOpNode::collectVARLHSVariable([[maybe_unused]] set &result) const { cerr << "ERROR: you can only have variables or unary ops on LHS of VAR" << endl; exit(EXIT_FAILURE); @@ -6175,7 +6216,8 @@ TrinaryOpNode::computeSubExprContainingVariable(int symb_id, int lag, set &contain_var, expr_t rhs) const +TrinaryOpNode::normalizeEquationHelper([[maybe_unused]] const set &contain_var, + [[maybe_unused]] expr_t rhs) const { throw NormalizationFailed(); } @@ -6473,13 +6515,15 @@ TrinaryOpNode::differentiateForwardVars(const vector &subset, subst_tabl } bool -TrinaryOpNode::isNumConstNodeEqualTo(double value) const +TrinaryOpNode::isNumConstNodeEqualTo([[maybe_unused]] double value) const { return false; } bool -TrinaryOpNode::isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const +TrinaryOpNode::isVariableNodeEqualTo([[maybe_unused]] SymbolType type_arg, + [[maybe_unused]] int variable_id, + [[maybe_unused]] int lag_arg) const { return false; } @@ -6629,7 +6673,7 @@ AbstractExternalFunctionNode::writeBytecodeExternalFunctionArguments(BytecodeWri } void -AbstractExternalFunctionNode::collectVARLHSVariable(set &result) const +AbstractExternalFunctionNode::collectVARLHSVariable([[maybe_unused]] set &result) const { cerr << "ERROR: you can only have variables or unary ops on LHS of VAR" << endl; exit(EXIT_FAILURE); @@ -6643,7 +6687,7 @@ AbstractExternalFunctionNode::collectDynamicVariables(SymbolType type_arg, set

&derivOrder, map, temporary_terms_t> &temp_terms_map, - map>> &reference_count, - bool is_matlab) const + [[maybe_unused]] map>> &reference_count, + [[maybe_unused]] bool is_matlab) const { /* All external function nodes are declared as temporary terms. @@ -6943,7 +6987,7 @@ AbstractExternalFunctionNode::computeTemporaryTerms(const pair &derivO void AbstractExternalFunctionNode::computeBlockTemporaryTerms(int blk, int eq, vector> &blocks_temporary_terms, - map> &reference_count) const + [[maybe_unused]] map> &reference_count) const { // See comments in computeTemporaryTerms() for the logic expr_t this2 = const_cast(this); @@ -6959,13 +7003,15 @@ AbstractExternalFunctionNode::computeBlockTemporaryTerms(int blk, int eq, vector } bool -AbstractExternalFunctionNode::isNumConstNodeEqualTo(double value) const +AbstractExternalFunctionNode::isNumConstNodeEqualTo([[maybe_unused]] double value) const { return false; } bool -AbstractExternalFunctionNode::isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const +AbstractExternalFunctionNode::isVariableNodeEqualTo([[maybe_unused]] SymbolType type_arg, + [[maybe_unused]] int variable_id, + [[maybe_unused]] int lag_arg) const { return false; } @@ -7044,7 +7090,8 @@ AbstractExternalFunctionNode::computeSubExprContainingVariable(int symb_id, int } BinaryOpNode * -AbstractExternalFunctionNode::normalizeEquationHelper(const set &contain_var, expr_t rhs) const +AbstractExternalFunctionNode::normalizeEquationHelper([[maybe_unused]] const set &contain_var, + [[maybe_unused]] expr_t rhs) const { throw NormalizationFailed(); } @@ -7170,7 +7217,8 @@ ExternalFunctionNode::composeDerivatives(const vector &dargs) void ExternalFunctionNode::writeBytecodeOutput(BytecodeWriter &code_file, bool lhs_rhs, const temporary_terms_t &temporary_terms, - const temporary_terms_idxs_t &temporary_terms_idxs, bool dynamic, bool steady_dynamic, + const temporary_terms_idxs_t &temporary_terms_idxs, bool dynamic, + [[maybe_unused]] bool steady_dynamic, const deriv_node_temp_terms_t &tef_terms) const { if (checkIfTemporaryTermThenWriteBytecode(code_file, temporary_terms, temporary_terms_idxs, dynamic)) @@ -7475,7 +7523,7 @@ void FirstDerivExternalFunctionNode::writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, - bool isdynamic) const + [[maybe_unused]] bool isdynamic) const { // If current node is a temporary term if (temporary_terms.contains(const_cast(this))) @@ -7542,7 +7590,8 @@ FirstDerivExternalFunctionNode::writeOutput(ostream &output, ExprNodeOutputType void FirstDerivExternalFunctionNode::writeBytecodeOutput(BytecodeWriter &code_file, bool lhs_rhs, const temporary_terms_t &temporary_terms, - const temporary_terms_idxs_t &temporary_terms_idxs, bool dynamic, bool steady_dynamic, + const temporary_terms_idxs_t &temporary_terms_idxs, bool dynamic, + [[maybe_unused]] bool steady_dynamic, const deriv_node_temp_terms_t &tef_terms) const { if (checkIfTemporaryTermThenWriteBytecode(code_file, temporary_terms, temporary_terms_idxs, dynamic)) @@ -7797,7 +7846,7 @@ SecondDerivExternalFunctionNode::SecondDerivExternalFunctionNode(DataTree &datat } expr_t -SecondDerivExternalFunctionNode::composeDerivatives(const vector &dargs) +SecondDerivExternalFunctionNode::composeDerivatives([[maybe_unused]] const vector &dargs) { cerr << "ERROR: third order derivatives of external functions are not implemented" << endl; exit(EXIT_FAILURE); @@ -7816,7 +7865,7 @@ void SecondDerivExternalFunctionNode::writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, - bool isdynamic) const + [[maybe_unused]] bool isdynamic) const { // If current node is a temporary term if (temporary_terms.contains(const_cast(this))) @@ -8059,7 +8108,8 @@ SecondDerivExternalFunctionNode::computeXrefs(EquationInfo &ei) const void SecondDerivExternalFunctionNode::writeBytecodeOutput(BytecodeWriter &code_file, bool lhs_rhs, const temporary_terms_t &temporary_terms, - const temporary_terms_idxs_t &temporary_terms_idxs, bool dynamic, bool steady_dynamic, + const temporary_terms_idxs_t &temporary_terms_idxs, bool dynamic, + [[maybe_unused]] bool steady_dynamic, const deriv_node_temp_terms_t &tef_terms) const { if (checkIfTemporaryTermThenWriteBytecode(code_file, temporary_terms, temporary_terms_idxs, dynamic)) @@ -8150,25 +8200,26 @@ SubModelNode::SubModelNode(DataTree &datatree_arg, } void -SubModelNode::computeTemporaryTerms(const pair &derivOrder, - map, temporary_terms_t> &temp_terms_map, - map>> &reference_count, - bool is_matlab) const +SubModelNode::computeTemporaryTerms([[maybe_unused]] const pair &derivOrder, + [[maybe_unused]] map, temporary_terms_t> &temp_terms_map, + [[maybe_unused]] map>> &reference_count, + [[maybe_unused]] bool is_matlab) const { cerr << "SubModelNode::computeTemporaryTerms not implemented." << endl; exit(EXIT_FAILURE); } void -SubModelNode::computeBlockTemporaryTerms(int blk, int eq, vector> &blocks_temporary_terms, - map> &reference_count) const +SubModelNode::computeBlockTemporaryTerms([[maybe_unused]] int blk, [[maybe_unused]] int eq, + [[maybe_unused]] vector> &blocks_temporary_terms, + [[maybe_unused]] map> &reference_count) const { cerr << "SubModelNode::computeBlocksTemporaryTerms not implemented." << endl; exit(EXIT_FAILURE); } expr_t -SubModelNode::toStatic(DataTree &static_datatree) const +SubModelNode::toStatic([[maybe_unused]] DataTree &static_datatree) const { cerr << "SubModelNode::toStatic not implemented." << endl; exit(EXIT_FAILURE); @@ -8182,14 +8233,15 @@ SubModelNode::prepareForDerivation() } expr_t -SubModelNode::computeDerivative(int deriv_id) +SubModelNode::computeDerivative([[maybe_unused]] int deriv_id) { cerr << "SubModelNode::computeDerivative not implemented." << endl; exit(EXIT_FAILURE); } expr_t -SubModelNode::getChainRuleDerivative(int deriv_id, const map &recursive_variables) +SubModelNode::getChainRuleDerivative([[maybe_unused]] int deriv_id, + [[maybe_unused]] const map &recursive_variables) { cerr << "SubModelNode::getChainRuleDerivative not implemented." << endl; exit(EXIT_FAILURE); @@ -8245,14 +8297,14 @@ SubModelNode::undiff() const } int -SubModelNode::VarMaxLag(const set &lhs_lag_equiv) const +SubModelNode::VarMaxLag([[maybe_unused]] const set &lhs_lag_equiv) const { cerr << "SubModelNode::VarMaxLag not implemented." << endl; exit(EXIT_FAILURE); } expr_t -SubModelNode::decreaseLeadsLags(int n) const +SubModelNode::decreaseLeadsLags([[maybe_unused]] int n) const { cerr << "SubModelNode::decreaseLeadsLags not implemented." << endl; exit(EXIT_FAILURE); @@ -8267,28 +8319,34 @@ SubModelNode::countDiffs() const expr_t -SubModelNode::substituteEndoLeadGreaterThanTwo(subst_table_t &subst_table, vector &neweqs, bool deterministic_model) const +SubModelNode::substituteEndoLeadGreaterThanTwo([[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs, + [[maybe_unused]] bool deterministic_model) const { cerr << "SubModelNode::substituteEndoLeadGreaterThanTwo not implemented." << endl; exit(EXIT_FAILURE); } expr_t -SubModelNode::substituteEndoLagGreaterThanTwo(subst_table_t &subst_table, vector &neweqs) const +SubModelNode::substituteEndoLagGreaterThanTwo([[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs) const { cerr << "SubModelNode::substituteEndoLagGreaterThanTwo not implemented." << endl; exit(EXIT_FAILURE); } expr_t -SubModelNode::substituteExoLead(subst_table_t &subst_table, vector &neweqs, bool deterministic_model) const +SubModelNode::substituteExoLead([[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs, + [[maybe_unused]] bool deterministic_model) const { cerr << "SubModelNode::substituteExoLead not implemented." << endl; exit(EXIT_FAILURE); } expr_t -SubModelNode::substituteExoLag(subst_table_t &subst_table, vector &neweqs) const +SubModelNode::substituteExoLag([[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs) const { cerr << "SubModelNode::substituteExoLag not implemented." << endl; exit(EXIT_FAILURE); @@ -8301,51 +8359,60 @@ SubModelNode::containsExternalFunction() const } double -SubModelNode::eval(const eval_context_t &eval_context) const noexcept(false) +SubModelNode::eval([[maybe_unused]] const eval_context_t &eval_context) const noexcept(false) { throw EvalException(); } void -SubModelNode::computeXrefs(EquationInfo &ei) const +SubModelNode::computeXrefs([[maybe_unused]] EquationInfo &ei) const { } void -SubModelNode::collectVARLHSVariable(set &result) const +SubModelNode::collectVARLHSVariable([[maybe_unused]] set &result) const { cerr << "ERROR: you can only have variables or unary ops on LHS of VAR" << endl; exit(EXIT_FAILURE); } void -SubModelNode::collectDynamicVariables(SymbolType type_arg, set> &result) const +SubModelNode::collectDynamicVariables([[maybe_unused]] SymbolType type_arg, + [[maybe_unused]] set> &result) const { } void -SubModelNode::writeBytecodeOutput(BytecodeWriter &code_file, bool lhs_rhs, - const temporary_terms_t &temporary_terms, - const temporary_terms_idxs_t &temporary_terms_idxs, bool dynamic, bool steady_dynamic, - const deriv_node_temp_terms_t &tef_terms) const +SubModelNode::writeBytecodeOutput([[maybe_unused]] BytecodeWriter &code_file, + [[maybe_unused]] bool lhs_rhs, + [[maybe_unused]] const temporary_terms_t &temporary_terms, + [[maybe_unused]] const temporary_terms_idxs_t &temporary_terms_idxs, + [[maybe_unused]] bool dynamic, + [[maybe_unused]] bool steady_dynamic, + [[maybe_unused]] const deriv_node_temp_terms_t &tef_terms) const { cerr << "SubModelNode::compile not implemented." << endl; exit(EXIT_FAILURE); } void -SubModelNode::computeSubExprContainingVariable(int symb_id, int lag, set &contain_var) const +SubModelNode::computeSubExprContainingVariable([[maybe_unused]] int symb_id, + [[maybe_unused]] int lag, + [[maybe_unused]] set &contain_var) const { } BinaryOpNode * -SubModelNode::normalizeEquationHelper(const set &contain_var, expr_t rhs) const +SubModelNode::normalizeEquationHelper([[maybe_unused]] const set &contain_var, + [[maybe_unused]] expr_t rhs) const { throw NormalizationFailed(); } expr_t -SubModelNode::substituteExpectation(subst_table_t &subst_table, vector &neweqs, bool partial_information_model) const +SubModelNode::substituteExpectation([[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs, + [[maybe_unused]] bool partial_information_model) const { return const_cast(this); } @@ -8363,42 +8430,47 @@ SubModelNode::substituteModelLocalVariables() const } void -SubModelNode::findDiffNodes(lag_equivalence_table_t &nodes) const +SubModelNode::findDiffNodes([[maybe_unused]] lag_equivalence_table_t &nodes) const { } void -SubModelNode::findUnaryOpNodesForAuxVarCreation(lag_equivalence_table_t &nodes) const +SubModelNode::findUnaryOpNodesForAuxVarCreation([[maybe_unused]] lag_equivalence_table_t &nodes) const { } optional -SubModelNode::findTargetVariable(int lhs_symb_id) const +SubModelNode::findTargetVariable([[maybe_unused]] int lhs_symb_id) const { return nullopt; } expr_t -SubModelNode::substituteDiff(const lag_equivalence_table_t &nodes, subst_table_t &subst_table, - vector &neweqs) const +SubModelNode::substituteDiff([[maybe_unused]] const lag_equivalence_table_t &nodes, + [[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs) const { return const_cast(this); } expr_t -SubModelNode::substituteUnaryOpNodes(const lag_equivalence_table_t &nodes, subst_table_t &subst_table, vector &neweqs) const +SubModelNode::substituteUnaryOpNodes([[maybe_unused]] const lag_equivalence_table_t &nodes, + [[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs) const { return const_cast(this); } bool -SubModelNode::isNumConstNodeEqualTo(double value) const +SubModelNode::isNumConstNodeEqualTo([[maybe_unused]] double value) const { return false; } bool -SubModelNode::isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const +SubModelNode::isVariableNodeEqualTo([[maybe_unused]] SymbolType type_arg, + [[maybe_unused]] int variable_id, + [[maybe_unused]] int lag_arg) const { return false; } @@ -8422,13 +8494,15 @@ SubModelNode::substituteStaticAuxiliaryVariable() const } expr_t -SubModelNode::replaceVarsInEquation(map &table) const +SubModelNode::replaceVarsInEquation([[maybe_unused]] map &table) const { return const_cast(this); } expr_t -SubModelNode::differentiateForwardVars(const vector &subset, subst_table_t &subst_table, vector &neweqs) const +SubModelNode::differentiateForwardVars([[maybe_unused]] const vector &subset, + [[maybe_unused]] subst_table_t &subst_table, + [[maybe_unused]] vector &neweqs) const { cerr << "SubModelNode::differentiateForwardVars not implemented." << endl; exit(EXIT_FAILURE); @@ -8449,21 +8523,23 @@ SubModelNode::replaceTrendVar() const } expr_t -SubModelNode::detrend(int symb_id, bool log_trend, expr_t trend) const +SubModelNode::detrend([[maybe_unused]] int symb_id, [[maybe_unused]] bool log_trend, + [[maybe_unused]] expr_t trend) const { cerr << "SubModelNode::detrend not implemented." << endl; exit(EXIT_FAILURE); } expr_t -SubModelNode::removeTrendLeadLag(const map &trend_symbols_map) const +SubModelNode::removeTrendLeadLag([[maybe_unused]] const map &trend_symbols_map) const { cerr << "SubModelNode::removeTrendLeadLag not implemented." << endl; exit(EXIT_FAILURE); } expr_t -SubModelNode::substituteLogTransform(int orig_symb_id, int aux_symb_id) const +SubModelNode::substituteLogTransform([[maybe_unused]] int orig_symb_id, + [[maybe_unused]] int aux_symb_id) const { return const_cast(this); } @@ -8497,9 +8573,9 @@ VarExpectationNode::maxLagWithDiffsExpanded() const void VarExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type, - const temporary_terms_t &temporary_terms, - const temporary_terms_idxs_t &temporary_terms_idxs, - const deriv_node_temp_terms_t &tef_terms) const + [[maybe_unused]] const temporary_terms_t &temporary_terms, + [[maybe_unused]] const temporary_terms_idxs_t &temporary_terms_idxs, + [[maybe_unused]] const deriv_node_temp_terms_t &tef_terms) const { assert(output_type != ExprNodeOutputType::matlabOutsideModel); @@ -8526,25 +8602,27 @@ VarExpectationNode::substituteVarExpectation(const map &subst_ta } expr_t -VarExpectationNode::substitutePacExpectation(const string &name, expr_t subexpr) +VarExpectationNode::substitutePacExpectation([[maybe_unused]] const string &name, + [[maybe_unused]] expr_t subexpr) { return const_cast(this); } expr_t -VarExpectationNode::substitutePacTargetNonstationary(const string &name, expr_t subexpr) +VarExpectationNode::substitutePacTargetNonstationary([[maybe_unused]] const string &name, + [[maybe_unused]] expr_t subexpr) { return const_cast(this); } bool -VarExpectationNode::containsPacExpectation(const string &pac_model_name) const +VarExpectationNode::containsPacExpectation([[maybe_unused]] const string &pac_model_name) const { return false; } bool -VarExpectationNode::containsPacTargetNonstationary(const string &pac_model_name) const +VarExpectationNode::containsPacTargetNonstationary([[maybe_unused]] const string &pac_model_name) const { return false; } @@ -8558,9 +8636,9 @@ VarExpectationNode::writeJsonAST(ostream &output) const void VarExpectationNode::writeJsonOutput(ostream &output, - const temporary_terms_t &temporary_terms, - const deriv_node_temp_terms_t &tef_terms, - bool isdynamic) const + [[maybe_unused]] const temporary_terms_t &temporary_terms, + [[maybe_unused]] const deriv_node_temp_terms_t &tef_terms, + [[maybe_unused]] bool isdynamic) const { output << "var_expectation(" << "model_name = " << model_name @@ -8582,9 +8660,9 @@ PacExpectationNode::clone(DataTree &datatree) const void PacExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type, - const temporary_terms_t &temporary_terms, - const temporary_terms_idxs_t &temporary_terms_idxs, - const deriv_node_temp_terms_t &tef_terms) const + [[maybe_unused]] const temporary_terms_t &temporary_terms, + [[maybe_unused]] const temporary_terms_idxs_t &temporary_terms_idxs, + [[maybe_unused]] const deriv_node_temp_terms_t &tef_terms) const { assert(output_type != ExprNodeOutputType::matlabOutsideModel); if (isLatexOutput(output_type)) @@ -8605,7 +8683,7 @@ PacExpectationNode::maxLagWithDiffsExpanded() const } expr_t -PacExpectationNode::substituteVarExpectation(const map &subst_table) const +PacExpectationNode::substituteVarExpectation([[maybe_unused]] const map &subst_table) const { return const_cast(this); } @@ -8620,7 +8698,7 @@ PacExpectationNode::containsPacExpectation(const string &pac_model_name) const } bool -PacExpectationNode::containsPacTargetNonstationary(const string &pac_model_name) const +PacExpectationNode::containsPacTargetNonstationary([[maybe_unused]] const string &pac_model_name) const { return false; } @@ -8634,9 +8712,9 @@ PacExpectationNode::writeJsonAST(ostream &output) const void PacExpectationNode::writeJsonOutput(ostream &output, - const temporary_terms_t &temporary_terms, - const deriv_node_temp_terms_t &tef_terms, - bool isdynamic) const + [[maybe_unused]] const temporary_terms_t &temporary_terms, + [[maybe_unused]] const deriv_node_temp_terms_t &tef_terms, + [[maybe_unused]] bool isdynamic) const { output << "pac_expectation(" << "model_name = " << model_name @@ -8652,7 +8730,8 @@ PacExpectationNode::substitutePacExpectation(const string &name, expr_t subexpr) } expr_t -PacExpectationNode::substitutePacTargetNonstationary(const string &name, expr_t subexpr) +PacExpectationNode::substitutePacTargetNonstationary([[maybe_unused]] const string &name, + [[maybe_unused]] expr_t subexpr) { return const_cast(this); } @@ -8672,9 +8751,9 @@ PacTargetNonstationaryNode::clone(DataTree &datatree) const void PacTargetNonstationaryNode::writeOutput(ostream &output, ExprNodeOutputType output_type, - const temporary_terms_t &temporary_terms, - const temporary_terms_idxs_t &temporary_terms_idxs, - const deriv_node_temp_terms_t &tef_terms) const + [[maybe_unused]] const temporary_terms_t &temporary_terms, + [[maybe_unused]] const temporary_terms_idxs_t &temporary_terms_idxs, + [[maybe_unused]] const deriv_node_temp_terms_t &tef_terms) const { assert(output_type != ExprNodeOutputType::matlabOutsideModel); if (isLatexOutput(output_type)) @@ -8695,13 +8774,13 @@ PacTargetNonstationaryNode::maxLagWithDiffsExpanded() const } expr_t -PacTargetNonstationaryNode::substituteVarExpectation(const map &subst_table) const +PacTargetNonstationaryNode::substituteVarExpectation([[maybe_unused]] const map &subst_table) const { return const_cast(this); } bool -PacTargetNonstationaryNode::containsPacExpectation(const string &pac_model_name) const +PacTargetNonstationaryNode::containsPacExpectation([[maybe_unused]] const string &pac_model_name) const { return false; } @@ -8724,9 +8803,9 @@ PacTargetNonstationaryNode::writeJsonAST(ostream &output) const void PacTargetNonstationaryNode::writeJsonOutput(ostream &output, - const temporary_terms_t &temporary_terms, - const deriv_node_temp_terms_t &tef_terms, - bool isdynamic) const + [[maybe_unused]] const temporary_terms_t &temporary_terms, + [[maybe_unused]] const deriv_node_temp_terms_t &tef_terms, + [[maybe_unused]] bool isdynamic) const { output << "pac_target_nonstationary(" << "model_name = " << model_name @@ -8734,7 +8813,8 @@ PacTargetNonstationaryNode::writeJsonOutput(ostream &output, } expr_t -PacTargetNonstationaryNode::substitutePacExpectation(const string &name, expr_t subexpr) +PacTargetNonstationaryNode::substitutePacExpectation([[maybe_unused]] const string &name, + [[maybe_unused]] expr_t subexpr) { return const_cast(this); } @@ -8811,13 +8891,17 @@ ExprNode::matchVariableTimesConstantTimesParam(bool variable_obligatory) const } void -ExprNode::matchVTCTPHelper(optional &var_id, int &lag, optional ¶m_id, double &constant, bool at_denominator) const +ExprNode::matchVTCTPHelper([[maybe_unused]] optional &var_id, [[maybe_unused]] int &lag, + [[maybe_unused]] optional ¶m_id, [[maybe_unused]] double &constant, + [[maybe_unused]] bool at_denominator) const { throw MatchFailureException{"Expression not allowed in linear combination of variables"}; } void -NumConstNode::matchVTCTPHelper(optional &var_id, int &lag, optional ¶m_id, double &constant, bool at_denominator) const +NumConstNode::matchVTCTPHelper([[maybe_unused]] optional &var_id, [[maybe_unused]] int &lag, + [[maybe_unused]] optional ¶m_id, double &constant, + bool at_denominator) const { double myvalue = eval({}); if (at_denominator) @@ -8827,7 +8911,8 @@ NumConstNode::matchVTCTPHelper(optional &var_id, int &lag, optional &p } void -VariableNode::matchVTCTPHelper(optional &var_id, int &lag, optional ¶m_id, double &constant, bool at_denominator) const +VariableNode::matchVTCTPHelper(optional &var_id, int &lag, optional ¶m_id, + [[maybe_unused]] double &constant, bool at_denominator) const { if (at_denominator) throw MatchFailureException{"A variable or parameter cannot appear at denominator"}; diff --git a/src/ModelTree.cc b/src/ModelTree.cc index 0e0e74f9..f6d33384 100644 --- a/src/ModelTree.cc +++ b/src/ModelTree.cc @@ -1025,9 +1025,9 @@ ModelTree::computeBlockTemporaryTerms() } void -ModelTree::additionalBlockTemporaryTerms(int blk, - vector> &blocks_temporary_terms, - map> &reference_count) const +ModelTree::additionalBlockTemporaryTerms([[maybe_unused]] int blk, + [[maybe_unused]] vector> &blocks_temporary_terms, + [[maybe_unused]] map> &reference_count) const { } diff --git a/src/NumericalInitialization.cc b/src/NumericalInitialization.cc index bd738aa7..0fc2d557 100644 --- a/src/NumericalInitialization.cc +++ b/src/NumericalInitialization.cc @@ -35,7 +35,7 @@ InitParamStatement::InitParamStatement(int symb_id_arg, } void -InitParamStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +InitParamStatement::checkPass(ModFileStructure &mod_file_struct, [[maybe_unused]] WarningConsolidation &warnings) { if (symbol_table.getName(symb_id) == "dsge_prior_weight") mod_file_struct.dsge_prior_weight_initialized = true; @@ -46,7 +46,7 @@ InitParamStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolid } void -InitParamStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +InitParamStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, bool minimal_workspace) const { int id = symbol_table.getTypeSpecificID(symb_id) + 1; output << "M_.params(" << id << ") = "; @@ -184,7 +184,8 @@ InitValStatement::InitValStatement(const init_values_t &init_values_arg, } void -InitValStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +InitValStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { set exogs = getUninitializedVariables(SymbolType::exogenous); set endogs = getUninitializedVariables(SymbolType::endogenous); @@ -210,7 +211,8 @@ InitValStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidat } void -InitValStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +InitValStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "%" << endl << "% INITVAL instructions" << endl @@ -248,7 +250,8 @@ EndValStatement::EndValStatement(const init_values_t &init_values_arg, } void -EndValStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +EndValStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { set exogs = getUninitializedVariables(SymbolType::exogenous); set endogs = getUninitializedVariables(SymbolType::endogenous); @@ -274,7 +277,8 @@ EndValStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidati } void -EndValStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +EndValStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "%" << endl << "% ENDVAL instructions" << endl @@ -304,7 +308,8 @@ EndValLearntInStatement::EndValLearntInStatement(int learnt_in_period_arg, } void -EndValLearntInStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +EndValLearntInStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.endval_learnt_in_present = true; } @@ -325,7 +330,8 @@ EndValLearntInStatement::typeToString(LearntEndValType type) } void -EndValLearntInStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +EndValLearntInStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "M_.learnt_endval = [ M_.learnt_endval;" << endl; for (auto [type, symb_id, value] : learnt_end_values) @@ -373,7 +379,8 @@ HistValStatement::HistValStatement(hist_values_t hist_values_arg, } void -HistValStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +HistValStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { if (all_values_required) { @@ -409,7 +416,8 @@ HistValStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidat } void -HistValStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +HistValStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "%" << endl << "% HISTVAL instructions" << endl @@ -474,7 +482,8 @@ InitvalFileStatement::InitvalFileStatement(OptionsList options_list_arg) : } void -InitvalFileStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +InitvalFileStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "%" << endl << "% INITVAL_FILE statement" << endl @@ -502,7 +511,8 @@ HistvalFileStatement::HistvalFileStatement(OptionsList options_list_arg) : } void -HistvalFileStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +HistvalFileStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "%" << endl << "% HISTVAL_FILE statement" << endl @@ -532,7 +542,8 @@ HomotopyStatement::HomotopyStatement(homotopy_values_t homotopy_values_arg, } void -HomotopyStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +HomotopyStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "%" << endl << "% HOMOTOPY_SETUP instructions" << endl @@ -586,7 +597,8 @@ SaveParamsAndSteadyStateStatement::SaveParamsAndSteadyStateStatement(string file } void -SaveParamsAndSteadyStateStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +SaveParamsAndSteadyStateStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "save_params_and_steady_state('" << filename << "');" << endl; } @@ -635,7 +647,8 @@ LoadParamsAndSteadyStateStatement::LoadParamsAndSteadyStateStatement(const strin } void -LoadParamsAndSteadyStateStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +LoadParamsAndSteadyStateStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { for (const auto &[id, value] : content) { diff --git a/src/Shocks.cc b/src/Shocks.cc index 97d952df..3f57c491 100644 --- a/src/Shocks.cc +++ b/src/Shocks.cc @@ -103,7 +103,8 @@ ShocksStatement::ShocksStatement(bool overwrite_arg, } void -ShocksStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +ShocksStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "%" << endl << "% SHOCKS instructions" << endl @@ -301,7 +302,8 @@ ShocksStatement::writeCovarAndCorrShocks(ostream &output) const } void -ShocksStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +ShocksStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { /* Error out if variables are not of the right type. This must be done here and not at parsing time (see #448). @@ -406,7 +408,8 @@ MShocksStatement::MShocksStatement(bool overwrite_arg, } void -MShocksStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +MShocksStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "%" << endl << "% MSHOCKS instructions" << endl @@ -440,13 +443,15 @@ ShocksSurpriseStatement::ShocksSurpriseStatement(bool overwrite_arg, } void -ShocksSurpriseStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +ShocksSurpriseStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.shocks_surprise_present = true; } void -ShocksSurpriseStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +ShocksSurpriseStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { if (overwrite) output << "M_.surprise_shocks = [" << endl; @@ -502,7 +507,8 @@ ShocksLearntInStatement::ShocksLearntInStatement(int learnt_in_period_arg, bool } void -ShocksLearntInStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +ShocksLearntInStatement::checkPass(ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { mod_file_struct.shocks_learnt_in_present = true; } @@ -523,7 +529,8 @@ ShocksLearntInStatement::typeToString(LearntShockType type) } void -ShocksLearntInStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +ShocksLearntInStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { if (overwrite) output << "if ~isempty(M_.learnt_shocks)" << endl @@ -596,7 +603,9 @@ ConditionalForecastPathsStatement::computePathLength(const AbstractShocksStateme } void -ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +ConditionalForecastPathsStatement::writeOutput(ostream &output, + [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { assert(path_length > 0); output << "constrained_vars_ = [];" << endl @@ -655,7 +664,8 @@ MomentCalibration::MomentCalibration(constraints_t constraints_arg, } void -MomentCalibration::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +MomentCalibration::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "options_.endogenous_prior_restrictions.moment = {" << endl; for (const auto &c : constraints) @@ -706,7 +716,8 @@ IrfCalibration::IrfCalibration(constraints_t constraints_arg, } void -IrfCalibration::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +IrfCalibration::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { options_list.writeOutput(output); @@ -763,7 +774,8 @@ ShockGroupsStatement::ShockGroupsStatement(group_t shock_groups_arg, string name } void -ShockGroupsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +ShockGroupsStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { int i = 1; for (auto it = shock_groups.begin(); it != shock_groups.end(); ++it) @@ -833,7 +845,8 @@ Init2shocksStatement::Init2shocksStatement(vector> init2shocks_ar } void -Init2shocksStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +Init2shocksStatement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { for (size_t i = 0; i < init2shocks.size(); i++) for (size_t j = i + 1; j < init2shocks.size(); j++) @@ -847,7 +860,8 @@ Init2shocksStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsol } void -Init2shocksStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +Init2shocksStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "M_.init2shocks." << name << " = {" << endl; for (const auto &[id1, id2] : init2shocks) @@ -879,7 +893,8 @@ HeteroskedasticShocksStatement::HeteroskedasticShocksStatement(bool overwrite_ar } void -HeteroskedasticShocksStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +HeteroskedasticShocksStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { // NB: The first initialization of the fields is done in ModFile::writeMOutput() if (overwrite) diff --git a/src/SigmaeInitialization.cc b/src/SigmaeInitialization.cc index 6b239968..07cded9b 100644 --- a/src/SigmaeInitialization.cc +++ b/src/SigmaeInitialization.cc @@ -60,7 +60,8 @@ SigmaeStatement::determineMatrixForm(const matrix_t &matrix) noexcept(false) } void -SigmaeStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +SigmaeStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << "M_.Sigma_e = [..." << endl; for (size_t ir = 0; ir < matrix.size(); ir++) diff --git a/src/Statement.cc b/src/Statement.cc index 77d532a6..fbe32d74 100644 --- a/src/Statement.cc +++ b/src/Statement.cc @@ -25,12 +25,13 @@ #include void -Statement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +Statement::checkPass([[maybe_unused]] ModFileStructure &mod_file_struct, + [[maybe_unused]] WarningConsolidation &warnings) { } void -Statement::computingPass(const ModFileStructure &mod_file_struct) +Statement::computingPass([[maybe_unused]] const ModFileStructure &mod_file_struct) { } @@ -40,7 +41,8 @@ NativeStatement::NativeStatement(string native_statement_arg) : } void -NativeStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +NativeStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { using namespace boost::xpressive; string date_regex = R"((-?\d+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[SsHh][1-2])))"; @@ -104,7 +106,8 @@ VerbatimStatement::VerbatimStatement(string verbatim_statement_arg) : } void -VerbatimStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +VerbatimStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename, + [[maybe_unused]] bool minimal_workspace) const { output << verbatim_statement << endl; } diff --git a/src/StaticModel.cc b/src/StaticModel.cc index 1ae065ef..a88e33dc 100644 --- a/src/StaticModel.cc +++ b/src/StaticModel.cc @@ -1893,7 +1893,7 @@ StaticModel::getTypeByDerivID(int deriv_id) const noexcept(false) } int -StaticModel::getLagByDerivID(int deriv_id) const noexcept(false) +StaticModel::getLagByDerivID([[maybe_unused]] int deriv_id) const noexcept(false) { return 0; } @@ -1910,7 +1910,7 @@ StaticModel::getSymbIDByDerivID(int deriv_id) const noexcept(false) } int -StaticModel::getDerivID(int symb_id, int lag) const noexcept(false) +StaticModel::getDerivID(int symb_id, [[maybe_unused]] int lag) const noexcept(false) { if (symbol_table.getType(symb_id) == SymbolType::endogenous) return symbol_table.getTypeSpecificID(symb_id); diff --git a/src/macro/Directives.cc b/src/macro/Directives.cc index d97c64c5..4f441cde 100644 --- a/src/macro/Directives.cc +++ b/src/macro/Directives.cc @@ -25,7 +25,7 @@ using namespace macro; void -Eval::interpret(ostream &output, Environment &env, vector &paths) +Eval::interpret(ostream &output, Environment &env, [[maybe_unused]] vector &paths) { try { @@ -91,7 +91,7 @@ Include::interpret(ostream &output, Environment &env, vector & } void -IncludePath::interpret(ostream &output, Environment &env, vector &paths) +IncludePath::interpret([[maybe_unused]] ostream &output, Environment &env, vector &paths) { using namespace filesystem; try @@ -131,7 +131,7 @@ IncludePath::interpret(ostream &output, Environment &env, vector &paths) +Define::interpret([[maybe_unused]] ostream &output, Environment &env, [[maybe_unused]] vector &paths) { try { @@ -154,7 +154,7 @@ Define::interpret(ostream &output, Environment &env, vector &p } void -Echo::interpret(ostream &output, Environment &env, vector &paths) +Echo::interpret(ostream &output, Environment &env, [[maybe_unused]] vector &paths) { try { @@ -173,7 +173,7 @@ Echo::interpret(ostream &output, Environment &env, vector &pat } void -Error::interpret(ostream &output, Environment &env, vector &paths) +Error::interpret([[maybe_unused]] ostream &output, Environment &env, [[maybe_unused]] vector &paths) { try { @@ -191,7 +191,7 @@ Error::interpret(ostream &output, Environment &env, vector &pa } void -EchoMacroVars::interpret(ostream &output, Environment &env, vector &paths) +EchoMacroVars::interpret(ostream &output, Environment &env, [[maybe_unused]] vector &paths) { if (save) env.print(output, vars, location.begin.line, true); diff --git a/src/macro/Directives.hh b/src/macro/Directives.hh index 7796df41..89f93347 100644 --- a/src/macro/Directives.hh +++ b/src/macro/Directives.hh @@ -48,7 +48,7 @@ namespace macro TextNode(string text_arg, Tokenizer::location location_arg) : Directive(move(location_arg)), text{move(text_arg)} { } void - interpret(ostream &output, Environment &env, vector &paths) override + interpret(ostream &output, [[maybe_unused]] Environment &env, [[maybe_unused]] vector &paths) override { output << text; } diff --git a/src/macro/Expressions.cc b/src/macro/Expressions.cc index 13059bfe..7c6e6310 100644 --- a/src/macro/Expressions.cc +++ b/src/macro/Expressions.cc @@ -306,7 +306,7 @@ String::is_equal(const BaseTypePtr &btp) const } BoolPtr -String::cast_bool(Environment &env) const +String::cast_bool([[maybe_unused]] Environment &env) const { auto f = [](const char &a, const char &b) { return (tolower(a) == tolower(b)); }; @@ -331,7 +331,7 @@ String::cast_bool(Environment &env) const } RealPtr -String::cast_real(Environment &env) const +String::cast_real([[maybe_unused]] Environment &env) const { try { diff --git a/src/macro/Expressions.hh b/src/macro/Expressions.hh index d6ae98dc..b66f5038 100644 --- a/src/macro/Expressions.hh +++ b/src/macro/Expressions.hh @@ -131,27 +131,27 @@ namespace macro explicit BaseType(Tokenizer::location location_arg = Tokenizer::location()) : Expression(move(location_arg)) { } virtual codes::BaseType getType() const noexcept = 0; - BaseTypePtr eval(Environment &env) override { return shared_from_this(); } + BaseTypePtr eval([[maybe_unused]] Environment &env) override { return shared_from_this(); } public: - virtual BaseTypePtr plus(const BaseTypePtr &bt) const { throw StackTrace("Operator + does not exist for this type"); } + virtual BaseTypePtr plus([[maybe_unused]] const BaseTypePtr &bt) const { throw StackTrace("Operator + does not exist for this type"); } virtual BaseTypePtr unary_plus() const { throw StackTrace("Unary operator + does not exist for this type"); } - virtual BaseTypePtr minus(const BaseTypePtr &bt) const { throw StackTrace("Operator - does not exist for this type"); } + virtual BaseTypePtr minus([[maybe_unused]] const BaseTypePtr &bt) const { throw StackTrace("Operator - does not exist for this type"); } virtual BaseTypePtr unary_minus() const { throw StackTrace("Unary operator - does not exist for this type"); } - virtual BaseTypePtr times(const BaseTypePtr &bt) const { throw StackTrace("Operator * does not exist for this type"); } - virtual BaseTypePtr divide(const BaseTypePtr &bt) const { throw StackTrace("Operator / does not exist for this type"); } - virtual BaseTypePtr power(const BaseTypePtr &btp) const { throw StackTrace("Operator ^ does not exist for this type"); } - virtual BoolPtr is_less(const BaseTypePtr &btp) const { throw StackTrace("Operator < does not exist for this type"); } - virtual BoolPtr is_greater(const BaseTypePtr &btp) const { throw StackTrace("Operator > does not exist for this type"); } - virtual BoolPtr is_less_equal(const BaseTypePtr &btp) const { throw StackTrace("Operator <= does not exist for this type"); } - virtual BoolPtr is_greater_equal(const BaseTypePtr &btp) const { throw StackTrace("Operator >= does not exist for this type"); } + virtual BaseTypePtr times([[maybe_unused]] const BaseTypePtr &bt) const { throw StackTrace("Operator * does not exist for this type"); } + virtual BaseTypePtr divide([[maybe_unused]] const BaseTypePtr &bt) const { throw StackTrace("Operator / does not exist for this type"); } + virtual BaseTypePtr power([[maybe_unused]] const BaseTypePtr &btp) const { throw StackTrace("Operator ^ does not exist for this type"); } + virtual BoolPtr is_less([[maybe_unused]] const BaseTypePtr &btp) const { throw StackTrace("Operator < does not exist for this type"); } + virtual BoolPtr is_greater([[maybe_unused]] const BaseTypePtr &btp) const { throw StackTrace("Operator > does not exist for this type"); } + virtual BoolPtr is_less_equal([[maybe_unused]] const BaseTypePtr &btp) const { throw StackTrace("Operator <= does not exist for this type"); } + virtual BoolPtr is_greater_equal([[maybe_unused]] const BaseTypePtr &btp) const { throw StackTrace("Operator >= does not exist for this type"); } virtual BoolPtr is_equal(const BaseTypePtr &btp) const = 0; virtual BoolPtr is_different(const BaseTypePtr &btp) const final; - virtual BoolPtr logical_and(const ExpressionPtr &ep, Environment &env) const { throw StackTrace("Operator && does not exist for this type"); } - virtual BoolPtr logical_or(const ExpressionPtr &ep, Environment &env) const { throw StackTrace("Operator || does not exist for this type"); } + virtual BoolPtr logical_and([[maybe_unused]] const ExpressionPtr &ep, [[maybe_unused]] Environment &env) const { throw StackTrace("Operator && does not exist for this type"); } + virtual BoolPtr logical_or([[maybe_unused]] const ExpressionPtr &ep, [[maybe_unused]] Environment &env) const { throw StackTrace("Operator || does not exist for this type"); } virtual BoolPtr logical_not() const { throw StackTrace("Operator ! does not exist for this type"); } - virtual ArrayPtr set_union(const BaseTypePtr &btp) const { throw StackTrace("Operator | does not exist for this type"); } - virtual ArrayPtr set_intersection(const BaseTypePtr &btp) const { throw StackTrace("Operator & does not exist for this type"); } - virtual BoolPtr contains(const BaseTypePtr &btp) const { throw StackTrace("Second argument of `in` operator must be an array"); } + virtual ArrayPtr set_union([[maybe_unused]] const BaseTypePtr &btp) const { throw StackTrace("Operator | does not exist for this type"); } + virtual ArrayPtr set_intersection([[maybe_unused]] const BaseTypePtr &btp) const { throw StackTrace("Operator & does not exist for this type"); } + virtual BoolPtr contains([[maybe_unused]] const BaseTypePtr &btp) const { throw StackTrace("Second argument of `in` operator must be an array"); } virtual RealPtr length() const { throw StackTrace("Operator `length` does not exist for this type"); } virtual BoolPtr isempty() const { throw StackTrace("Operator `isempty` does not exist for this type"); } virtual BoolPtr isboolean() const noexcept { return make_shared(false, location); } @@ -160,9 +160,9 @@ namespace macro virtual BoolPtr isstring() const noexcept { return make_shared(false, location); } virtual BoolPtr istuple() const noexcept { return make_shared(false, location); } virtual BoolPtr isarray() const noexcept { return make_shared(false, location); } - virtual RealPtr max(const BaseTypePtr &btp) const { throw StackTrace("Operator `max` does not exist for this type"); } - virtual RealPtr min(const BaseTypePtr &btp) const { throw StackTrace("Operator `min` does not exist for this type"); } - virtual RealPtr mod(const BaseTypePtr &btp) const { throw StackTrace("Operator `mod` does not exist for this type"); } + virtual RealPtr max([[maybe_unused]] const BaseTypePtr &btp) const { throw StackTrace("Operator `max` does not exist for this type"); } + virtual RealPtr min([[maybe_unused]] const BaseTypePtr &btp) const { throw StackTrace("Operator `min` does not exist for this type"); } + virtual RealPtr mod([[maybe_unused]] const BaseTypePtr &btp) const { throw StackTrace("Operator `mod` does not exist for this type"); } virtual RealPtr exp() const { throw StackTrace("Operator `exp` does not exist for this type"); } virtual RealPtr ln() const { throw StackTrace("Operator `ln` does not exist for this type"); } virtual RealPtr log10() const { throw StackTrace("Operator `log10` does not exist for this type"); } @@ -189,15 +189,15 @@ namespace macro virtual RealPtr lgamma() const { throw StackTrace("Operator `lgamma` does not exist for this type"); } virtual RealPtr round() const { throw StackTrace("Operator `round` does not exist for this type"); } virtual RealPtr normpdf() const { throw StackTrace("Operator `normpdf` does not exist for this type"); } - virtual RealPtr normpdf(const BaseTypePtr &btp1, const BaseTypePtr &btp2) const { throw StackTrace("Operator `normpdf` does not exist for this type"); } + virtual RealPtr normpdf([[maybe_unused]] const BaseTypePtr &btp1, [[maybe_unused]] const BaseTypePtr &btp2) const { throw StackTrace("Operator `normpdf` does not exist for this type"); } virtual RealPtr normcdf() const { throw StackTrace("Operator `normcdf` does not exist for this type"); } - virtual RealPtr normcdf(const BaseTypePtr &btp1, const BaseTypePtr &btp2) const { throw StackTrace("Operator `normcdf` does not exist for this type"); } - virtual BoolPtr cast_bool(Environment &env) const { throw StackTrace("This type cannot be cast to a boolean"); } - virtual RealPtr cast_real(Environment &env) const { throw StackTrace("This type cannot be cast to a real"); } + virtual RealPtr normcdf([[maybe_unused]] const BaseTypePtr &btp1, [[maybe_unused]] const BaseTypePtr &btp2) const { throw StackTrace("Operator `normcdf` does not exist for this type"); } + virtual BoolPtr cast_bool([[maybe_unused]] Environment &env) const { throw StackTrace("This type cannot be cast to a boolean"); } + virtual RealPtr cast_real([[maybe_unused]] Environment &env) const { throw StackTrace("This type cannot be cast to a real"); } virtual StringPtr cast_string() const { throw StackTrace("This type cannot be cast to a string"); } virtual TuplePtr cast_tuple() const { throw StackTrace("This type cannot be cast to a tuple"); } virtual ArrayPtr cast_array() const { throw StackTrace("This type cannot be cast to an array"); } - virtual BoolPtr defined(const Environment &env) const { throw StackTrace("Operator `defined` does not exist for this type"); } + virtual BoolPtr defined([[maybe_unused]] const Environment &env) const { throw StackTrace("Operator `defined` does not exist for this type"); } }; @@ -212,7 +212,7 @@ namespace macro value{value_arg} { } codes::BaseType getType() const noexcept override { return codes::BaseType::Bool; } string to_string() const noexcept override { return value ? "true" : "false"; } - void print(ostream &output, bool matlab_output = false) const noexcept override { output << to_string(); } + void print(ostream &output, [[maybe_unused]] bool matlab_output = false) const noexcept override { output << to_string(); } ExpressionPtr clone() const noexcept override { return make_shared(value, location); } public: operator bool() const { return value; } @@ -221,8 +221,8 @@ namespace macro BoolPtr logical_or(const ExpressionPtr &ep, Environment &env) const override; BoolPtr logical_not() const override; BoolPtr isboolean() const noexcept override { return make_shared(true, location); } - BoolPtr cast_bool(Environment &env) const override { return make_shared(value); } - RealPtr cast_real(Environment &env) const override { return value ? make_shared(1) : make_shared(0); } + BoolPtr cast_bool([[maybe_unused]] Environment &env) const override { return make_shared(value); } + RealPtr cast_real([[maybe_unused]] Environment &env) const override { return value ? make_shared(1) : make_shared(0); } StringPtr cast_string() const override { return make_shared(this->to_string()); } TuplePtr cast_tuple() const override @@ -260,7 +260,7 @@ namespace macro strs << setprecision(15) << value; return strs.str(); } - void print(ostream &output, bool matlab_output = false) const noexcept override { output << to_string(); } + void print(ostream &output, [[maybe_unused]] bool matlab_output = false) const noexcept override { output << to_string(); } ExpressionPtr clone() const noexcept override { return make_shared(value, location); } public: operator double() const { return value; } @@ -328,8 +328,8 @@ namespace macro return normcdf(make_shared(0), make_shared(1)); } RealPtr normcdf(const BaseTypePtr &btp1, const BaseTypePtr &btp2) const override; - BoolPtr cast_bool(Environment &env) const override { return make_shared(static_cast(value)); } - RealPtr cast_real(Environment &env) const override { return make_shared(value); } + BoolPtr cast_bool([[maybe_unused]] Environment &env) const override { return make_shared(static_cast(value)); } + RealPtr cast_real([[maybe_unused]] Environment &env) const override { return make_shared(value); } StringPtr cast_string() const override { return make_shared(this->to_string()); } TuplePtr cast_tuple() const override @@ -479,7 +479,7 @@ namespace macro retval += inc->to_string() + ":"; return retval + end->to_string() + "]"; } - void print(ostream &output, bool matlab_output = false) const noexcept override { output << to_string(); } + void print(ostream &output, [[maybe_unused]] bool matlab_output = false) const noexcept override { output << to_string(); } BaseTypePtr eval(Environment &env) override; ExpressionPtr clone() const noexcept override @@ -490,7 +490,7 @@ namespace macro } public: BoolPtr - is_equal(const BaseTypePtr &btp) const override + is_equal([[maybe_unused]] const BaseTypePtr &btp) const override { throw StackTrace("Internal error: Range: Should not arrive here: is_equal"); } @@ -510,7 +510,7 @@ namespace macro Tokenizer::location location_arg) : Expression(move(location_arg)), name{move(name_arg)}, indices{move(indices_arg)} { } string to_string() const noexcept override { return name; } - void print(ostream &output, bool matlab_output = false) const noexcept override { output << name; } + void print(ostream &output, [[maybe_unused]] bool matlab_output = false) const noexcept override { output << name; } BaseTypePtr eval(Environment &env) override; ExpressionPtr clone() const noexcept override @@ -536,7 +536,7 @@ namespace macro Expression(move(location_arg)), name{move(name_arg)}, args{move(args_arg)} { } string to_string() const noexcept override; void - print(ostream &output, bool matlab_output = false) const noexcept override + print(ostream &output, [[maybe_unused]] bool matlab_output = false) const noexcept override { printName(output); printArgs(output); } @@ -640,7 +640,7 @@ namespace macro Tokenizer::location location_arg) : Expression(move(location_arg)), c_expr{move(c_expr_arg)}, c_vars{move(c_vars_arg)}, c_set{move(c_set_arg)} { } - Comprehension(bool filter_only_arg, + Comprehension([[maybe_unused]] bool filter_only_arg, ExpressionPtr c_vars_arg, ExpressionPtr c_set_arg, ExpressionPtr c_when_arg,