Commit 1e56c733 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Port to C++11 nullptr keyword

Performed using modernize-use-nullptr from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
parent e73ebc70
......@@ -3880,8 +3880,8 @@ BasicPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
}
auto it_stdev = options_list.num_options.find("stdev");
if ((it_stdev == options_list.num_options.end() && variance == NULL)
|| (it_stdev != options_list.num_options.end() && variance != NULL))
if ((it_stdev == options_list.num_options.end() && variance == nullptr)
|| (it_stdev != options_list.num_options.end() && variance != nullptr))
{
cerr << "ERROR: You must pass exactly one of stdev and variance to the prior statement." << endl;
exit(EXIT_FAILURE);
......@@ -3973,7 +3973,7 @@ BasicPriorStatement::writeJsonPriorOutput(ostream &output) const
<< ", \"subsample\": \"" << subsample_name << "\""
<< ", ";
writeJsonShape(output);
if (variance != NULL)
if (variance != nullptr)
{
output << ", \"variance\": \"";
variance->writeJsonOutput(output, {}, {});
......
......@@ -122,7 +122,7 @@ ConfigFile::getConfigFileInfo(const string &config_file)
defaultConfigFile += "\\dynare.ini";
}
#else
if (getenv("HOME") == NULL)
if (getenv("HOME") == nullptr)
{
if (parallel || parallel_test)
cerr << "ERROR: ";
......
......@@ -95,7 +95,7 @@ DataTree::AddPlus(expr_t iArg1, expr_t iArg2)
{
// Simplify x+(-y) in x-y
auto *uarg2 = dynamic_cast<UnaryOpNode *>(iArg2);
if (uarg2 != NULL && uarg2->get_op_code() == oUminus)
if (uarg2 != nullptr && uarg2->get_op_code() == oUminus)
return AddMinus(iArg1, uarg2->get_arg());
// To treat commutativity of "+"
......@@ -138,7 +138,7 @@ DataTree::AddUMinus(expr_t iArg1)
{
// Simplify -(-x) in x
auto *uarg = dynamic_cast<UnaryOpNode *>(iArg1);
if (uarg != NULL && uarg->get_op_code() == oUminus)
if (uarg != nullptr && uarg->get_op_code() == oUminus)
return uarg->get_arg();
return AddUnaryOp(oUminus, iArg1);
......
......@@ -337,7 +337,7 @@ DataTree::AddUnaryOp(UnaryOpcode op_code, expr_t arg, int arg_exp_info_set, int
// Try to reduce to a constant
// Case where arg is a constant and op_code == oUminus (i.e. we're adding a negative constant) is skipped
auto *carg = dynamic_cast<NumConstNode *>(arg);
if (op_code != oUminus || carg == NULL)
if (op_code != oUminus || carg == nullptr)
{
try
{
......
......@@ -215,7 +215,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
{
string tmp_s, sps;
ostringstream tmp_output, tmp1_output, global_output;
expr_t lhs = NULL, rhs = NULL;
expr_t lhs = nullptr, rhs = nullptr;
BinaryOpNode *eq_node;
ostringstream Ufoss;
vector<string> Uf(symbol_table.endo_nbr(), "");
......@@ -457,7 +457,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
output << " " << "% //Temporary variables" << endl;
for (auto it : v_temporary_terms[block][i])
{
if (dynamic_cast<AbstractExternalFunctionNode *>(it) != NULL)
if (dynamic_cast<AbstractExternalFunctionNode *>(it) != nullptr)
it->writeExternalFunctionOutput(output, local_output_type, tt2, temporary_terms_idxs, tef_terms);
output << " " << sps;
......@@ -1063,7 +1063,7 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
ostringstream tmp_output;
ofstream code_file;
unsigned int instruction_number = 0;
expr_t lhs = NULL, rhs = NULL;
expr_t lhs = nullptr, rhs = nullptr;
BinaryOpNode *eq_node;
Uff Uf[symbol_table.endo_nbr()];
map<expr_t, int> reference_count;
......@@ -1198,7 +1198,7 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
{
for (auto it : v_temporary_terms[block][i])
{
if (dynamic_cast<AbstractExternalFunctionNode *>(it) != NULL)
if (dynamic_cast<AbstractExternalFunctionNode *>(it) != nullptr)
it->compileExternalFunctionOutput(code_file, instruction_number, false, tt2, map_idx, true, false, tef_terms);
FNUMEXPR_ fnumexpr(TemporaryTerm, (int)(map_idx.find(it->idx)->second));
......@@ -1266,7 +1266,7 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
variable_ID = getBlockVariableID(block, i);
equation_ID = getBlockEquationID(block, i);
feedback_variables.push_back(variable_ID);
Uf[equation_ID].Ufl = NULL;
Uf[equation_ID].Ufl = nullptr;
goto end;
default:
end:
......@@ -1337,7 +1337,7 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
Uf[eqr].Ufl->pNext = (Uff_l *) malloc(sizeof(Uff_l));
Uf[eqr].Ufl = Uf[eqr].Ufl->pNext;
}
Uf[eqr].Ufl->pNext = NULL;
Uf[eqr].Ufl->pNext = nullptr;
Uf[eqr].Ufl->u = count_u;
Uf[eqr].Ufl->var = varr;
Uf[eqr].Ufl->lag = lag;
......@@ -3742,7 +3742,7 @@ DynamicModel::getUndiffLHSForPac(vector<int> &lhs, vector<expr_t> &lhs_expr_t, v
bool printerr = false;
ExprNode::subst_table_t::const_iterator it1;
expr_t node = NULL;
expr_t node = nullptr;
expr_t aux_var = lhs_expr_t.at(i);
for (it1 = diff_subst_table.begin(); it1 != diff_subst_table.end(); it1++)
if (it1->second == aux_var)
......@@ -3751,7 +3751,7 @@ DynamicModel::getUndiffLHSForPac(vector<int> &lhs, vector<expr_t> &lhs_expr_t, v
break;
}
if (node == NULL)
if (node == nullptr)
{
cerr << "Unexpected error encountered." << endl;
exit(EXIT_FAILURE);
......@@ -3837,7 +3837,7 @@ DynamicModel::substitutePacExpectation()
for (auto & equation : equations)
{
auto *substeq = dynamic_cast<BinaryOpNode *>(equation->substitutePacExpectation(subst_table));
assert(substeq != NULL);
assert(substeq != nullptr);
equation = substeq;
}
......@@ -4507,7 +4507,7 @@ DynamicModel::computeRamseyPolicyFOCs(const StaticModel &static_model, const boo
for (i = 0; i < (int) equations.size(); i++)
{
auto *substeq = dynamic_cast<BinaryOpNode *>(equations[i]->addMultipliersToConstraints(i));
assert(substeq != NULL);
assert(substeq != nullptr);
equations[i] = substeq;
}
if (!nopreprocessoroutput)
......@@ -4544,7 +4544,7 @@ DynamicModel::computeRamseyPolicyFOCs(const StaticModel &static_model, const boo
for (i = 0; i < (int) equations.size(); i++)
for (int lag = -max_eq_lag; lag <= max_eq_lead; lag++)
{
expr_t dfpower = NULL;
expr_t dfpower = nullptr;
std::stringstream lagstream;
lagstream << abs(lag);
if (lag < 0)
......@@ -5264,7 +5264,7 @@ DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model
exit(EXIT_FAILURE);
}
auto *substeq = dynamic_cast<BinaryOpNode *>(subst);
assert(substeq != NULL);
assert(substeq != nullptr);
equation = substeq;
}
......@@ -5297,7 +5297,7 @@ DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model
exit(EXIT_FAILURE);
}
auto *substeq = dynamic_cast<BinaryOpNode *>(subst);
assert(substeq != NULL);
assert(substeq != nullptr);
aux_equation = substeq;
}
......@@ -5330,7 +5330,7 @@ DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model
exit(EXIT_FAILURE);
}
auto *substeq = dynamic_cast<BinaryOpNode *>(subst);
assert(substeq != NULL);
assert(substeq != nullptr);
diff_aux_equation = substeq;
}
......@@ -5404,7 +5404,7 @@ DynamicModel::substituteUnaryOps(StaticModel &static_model)
{
auto *substeq = dynamic_cast<BinaryOpNode *>(equation->
substituteUnaryOpNodes(static_model, nodes, subst_table, neweqs));
assert(substeq != NULL);
assert(substeq != nullptr);
equation = substeq;
}
......@@ -5439,7 +5439,7 @@ DynamicModel::substituteDiff(StaticModel &static_model, ExprNode::subst_table_t
{
auto *substeq = dynamic_cast<BinaryOpNode *>(equation->
substituteDiff(static_model, diff_table, diff_subst_table, neweqs));
assert(substeq != NULL);
assert(substeq != nullptr);
equation = substeq;
}
......@@ -5473,7 +5473,7 @@ DynamicModel::substituteExpectation(bool partial_information_model)
for (auto & equation : equations)
{
auto *substeq = dynamic_cast<BinaryOpNode *>(equation->substituteExpectation(subst_table, neweqs, partial_information_model));
assert(substeq != NULL);
assert(substeq != nullptr);
equation = substeq;
}
......@@ -5502,7 +5502,7 @@ DynamicModel::transformPredeterminedVariables()
for (auto & equation : equations)
{
auto *substeq = dynamic_cast<BinaryOpNode *>(equation->decreaseLeadsLagsPredeterminedVariables());
assert(substeq != NULL);
assert(substeq != nullptr);
equation = substeq;
}
}
......@@ -5516,14 +5516,14 @@ DynamicModel::detrendEquations()
for (auto & equation : equations)
{
auto *substeq = dynamic_cast<BinaryOpNode *>(equation->detrend(it->first, it->second.first, it->second.second));
assert(substeq != NULL);
assert(substeq != nullptr);
equation = dynamic_cast<BinaryOpNode *>(substeq);
}
for (auto & equation : equations)
{
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equation->removeTrendLeadLag(trend_symbols_map));
assert(substeq != NULL);
assert(substeq != nullptr);
equation = dynamic_cast<BinaryOpNode *>(substeq);
}
}
......@@ -5534,7 +5534,7 @@ DynamicModel::removeTrendVariableFromEquations()
for (auto & equation : equations)
{
auto *substeq = dynamic_cast<BinaryOpNode *>(equation->replaceTrendVar());
assert(substeq != NULL);
assert(substeq != nullptr);
equation = dynamic_cast<BinaryOpNode *>(substeq);
}
}
......@@ -5553,7 +5553,7 @@ DynamicModel::fillEvalContext(eval_context_t &eval_context) const
{
assert(aux_equation->get_op_code() == oEqual);
auto *auxvar = dynamic_cast<VariableNode *>(aux_equation->get_arg1());
assert(auxvar != NULL);
assert(auxvar != nullptr);
try
{
double val = aux_equation->get_arg2()->eval(eval_context);
......@@ -5604,7 +5604,7 @@ void
DynamicModel::addStaticOnlyEquation(expr_t eq, int lineno, const vector<pair<string, string> > &eq_tags)
{
auto *beq = dynamic_cast<BinaryOpNode *>(eq);
assert(beq != NULL && beq->get_op_code() == oEqual);
assert(beq != nullptr && beq->get_op_code() == oEqual);
vector<pair<string, string> > soe_eq_tags;
for (const auto & eq_tag : eq_tags)
......
This diff is collapsed.
......@@ -382,7 +382,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
it != statements.end(); it++)
{
auto *vms = dynamic_cast<VarModelStatement *>(*it);
if (vms != NULL)
if (vms != nullptr)
{
string var_model_name;
vms->getVarModelInfo(var_model_name, var_model_info_var_expectation, var_model_eq_tags);
......@@ -404,7 +404,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
make_pair(make_pair(max_lag, nonstationary), eqnumber));
}
auto *pms = dynamic_cast<PacModelStatement *>(*it);
if (pms != NULL)
if (pms != nullptr)
{
pair<string, pair<string, pair<string, pair<int, map<string, int> > > > >
pac_model_info_pac_expectation;
......@@ -459,14 +459,14 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
mod_file_struct.orig_eq_nbr = dynamic_model.equation_number();
if (mod_file_struct.ramsey_model_present)
{
StaticModel *planner_objective = NULL;
StaticModel *planner_objective = nullptr;
for (auto & statement : statements)
{
auto *pos = dynamic_cast<PlannerObjectiveStatement *>(statement);
if (pos != NULL)
if (pos != nullptr)
planner_objective = pos->getPlannerObjective();
}
assert(planner_objective != NULL);
assert(planner_objective != nullptr);
/*
clone the model then clone the new equations back to the original because
......@@ -524,7 +524,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
it != statements.end(); it++)
{
auto *vms = dynamic_cast<VarModelStatement *>(*it);
if (vms != NULL)
if (vms != nullptr)
{
string var_model_name;
vms->getVarModelInfo(var_model_name, var_model_info_var_expectation, var_model_eq_tags);
......@@ -598,7 +598,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
for (auto & statement : statements)
{
auto *rps = dynamic_cast<RamseyPolicyStatement *>(statement);
if (rps != NULL)
if (rps != nullptr)
rps->checkRamseyPolicyList();
}
......@@ -989,7 +989,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
/* Special treatment for initval block: insert initial values for the
auxiliary variables and initialize exo det */
auto *ivs = dynamic_cast<InitValStatement *>(statement);
if (ivs != NULL)
if (ivs != nullptr)
{
static_model.writeAuxVarInitval(mOutputFile, oMatlabOutsideModel);
ivs->writeOutputPostInit(mOutputFile);
......@@ -997,7 +997,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
// Special treatment for endval block: insert initial values for the auxiliary variables
auto *evs = dynamic_cast<EndValStatement *>(statement);
if (evs != NULL)
if (evs != nullptr)
static_model.writeAuxVarInitval(mOutputFile, oMatlabOutsideModel);
// Special treatment for load params and steady state statement: insert initial values for the auxiliary variables
......@@ -1007,7 +1007,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
// Special treatement for Var Models
auto *vms = dynamic_cast<VarModelStatement *>(statement);
if (vms != NULL)
if (vms != nullptr)
vms->createVarModelMFunction(mOutputFile, dynamic_model.getVarExpectationFunctionsToWrite());
}
......
......@@ -204,7 +204,7 @@ ModelTree::computeNonSingularNormalization(jacob_map_t &contemporaneous_jacobian
if (static_jacobian.find(make_pair(it->first.first, it->first.second)) == static_jacobian.end())
static_jacobian[make_pair(it->first.first, it->first.second)] = 0;
if (dynamic_jacobian.find(make_pair(0, make_pair(it->first.first, it->first.second))) == dynamic_jacobian.end())
dynamic_jacobian[make_pair(0, make_pair(it->first.first, it->first.second))] = 0;
dynamic_jacobian[make_pair(0, make_pair(it->first.first, it->first.second))] = nullptr;
if (contemporaneous_jacobian.find(make_pair(it->first.first, it->first.second)) == contemporaneous_jacobian.end())
contemporaneous_jacobian[make_pair(it->first.first, it->first.second)] = 0;
try
......@@ -235,7 +235,7 @@ ModelTree::computeNormalizedEquations(multimap<int, int> &endo2eqs) const
for (size_t i = 0; i < equations.size(); i++)
{
auto *lhs = dynamic_cast<VariableNode *>(equations[i]->get_arg1());
if (lhs == NULL)
if (lhs == nullptr)
continue;
int symb_id = lhs->get_symb_id();
......@@ -1224,7 +1224,7 @@ ModelTree::writeTemporaryTerms(const temporary_terms_t &tt,
for (auto it = tt.begin();
it != tt.end(); it++)
{
if (dynamic_cast<AbstractExternalFunctionNode *>(*it) != NULL)
if (dynamic_cast<AbstractExternalFunctionNode *>(*it) != nullptr)
(*it)->writeExternalFunctionOutput(output, output_type, tt2, tt_idxs, tef_terms);
if (IS_C(output_type))
......@@ -1257,7 +1257,7 @@ ModelTree::writeJsonTemporaryTerms(const temporary_terms_t &tt, const temporary_
for (auto it : tt)
if (ttm1.find(it) == ttm1.end())
{
if (dynamic_cast<AbstractExternalFunctionNode *>(it) != NULL)
if (dynamic_cast<AbstractExternalFunctionNode *>(it) != nullptr)
{
if (wrote_term)
output << ", ";
......@@ -1429,7 +1429,7 @@ ModelTree::compileTemporaryTerms(ostream &code_file, unsigned int &instruction_n
deriv_node_temp_terms_t tef_terms;
for (auto it : tt)
{
if (dynamic_cast<AbstractExternalFunctionNode *>(it) != NULL)
if (dynamic_cast<AbstractExternalFunctionNode *>(it) != nullptr)
{
it->compileExternalFunctionOutput(code_file, instruction_number, false, tt2, map_idx, dynamic, steady_dynamic, tef_terms);
}
......@@ -1734,7 +1734,7 @@ void
ModelTree::addEquation(expr_t eq, int lineno)
{
auto *beq = dynamic_cast<BinaryOpNode *>(eq);
assert(beq != NULL && beq->get_op_code() == oEqual);
assert(beq != nullptr && beq->get_op_code() == oEqual);
equations.push_back(beq);
equations_lineno.push_back(lineno);
......@@ -1753,7 +1753,7 @@ void
ModelTree::addAuxEquation(expr_t eq)
{
auto *beq = dynamic_cast<BinaryOpNode *>(eq);
assert(beq != NULL && beq->get_op_code() == oEqual);
assert(beq != nullptr && beq->get_op_code() == oEqual);
aux_equations.push_back(beq);
}
......
......@@ -37,7 +37,7 @@ NumericalConstants::AddNonNegativeConstant(const string &iConst)
mNumericalConstants.push_back(iConst);
numConstantsIndex[iConst] = id;
double val = strtod(iConst.c_str(), NULL);
double val = strtod(iConst.c_str(), nullptr);
/* Note that we allow underflows (will be converted to 0) and overflows (will
be converted to Inf), as MATLAB and Octave do. */
......
......@@ -495,7 +495,7 @@ HomotopyStatement::writeOutput(ostream &output, const string &basename, bool min
const int tsid = symbol_table.getTypeSpecificID(symb_id) + 1;
output << "options_.homotopy_values = vertcat(options_.homotopy_values, [ " << type << ", " << tsid << ", ";
if (expression1 != NULL)
if (expression1 != nullptr)
expression1->writeOutput(output);
else
output << "NaN";
......
......@@ -187,13 +187,13 @@ ParsingDriver::declare_symbol(const string *name, SymbolType type, const string
{
try
{
if (tex_name == NULL && partition_value == NULL)
if (tex_name == nullptr && partition_value == nullptr)
mod_file->symbol_table.addSymbol(*name, type);
else
if (tex_name == NULL)
if (tex_name == nullptr)
mod_file->symbol_table.addSymbol(*name, type, "", partition_value);
else if (partition_value == NULL)
mod_file->symbol_table.addSymbol(*name, type, *tex_name, NULL);
else if (partition_value == nullptr)
mod_file->symbol_table.addSymbol(*name, type, *tex_name, nullptr);
else
mod_file->symbol_table.addSymbol(*name, type, *tex_name, partition_value);
}
......@@ -211,9 +211,9 @@ ParsingDriver::declare_endogenous(string *name, string *tex_name, vector<pair<st
{
declare_symbol(name, eEndogenous, tex_name, partition_value);
delete name;
if (tex_name != NULL)
if (tex_name != nullptr)
delete tex_name;
if (partition_value != NULL)
if (partition_value != nullptr)
{
for (auto & it : *partition_value)
{
......@@ -238,7 +238,7 @@ ParsingDriver::declare_var_endogenous(string *name)
return;
}
declare_symbol(name, eEndogenousVAR, NULL, NULL);
declare_symbol(name, eEndogenousVAR, nullptr, nullptr);
add_in_symbol_list(name);
}
......@@ -247,9 +247,9 @@ ParsingDriver::declare_exogenous(string *name, string *tex_name, vector<pair<str
{
declare_symbol(name, eExogenous, tex_name, partition_value);
delete name;
if (tex_name != NULL)
if (tex_name != nullptr)
delete tex_name;
if (partition_value != NULL)
if (partition_value != nullptr)
{
for (auto & it : *partition_value)
{
......@@ -266,9 +266,9 @@ ParsingDriver::declare_exogenous_det(string *name, string *tex_name, vector<pair
{
declare_symbol(name, eExogenousDet, tex_name, partition_value);
delete name;
if (tex_name != NULL)
if (tex_name != nullptr)
delete tex_name;
if (partition_value != NULL)
if (partition_value != nullptr)
{
for (auto & it : *partition_value)
{
......@@ -285,9 +285,9 @@ ParsingDriver::declare_parameter(string *name, string *tex_name, vector<pair<str
{
declare_symbol(name, eParameter, tex_name, partition_value);
delete name;
if (tex_name != NULL)
if (tex_name != nullptr)
delete tex_name;
if (partition_value != NULL)
if (partition_value != nullptr)
{
for (auto & it : *partition_value)
{
......@@ -305,7 +305,7 @@ ParsingDriver::declare_statement_local_variable(string *name)
if (mod_file->symbol_table.exists(*name))
error("Symbol " + *name + " cannot be assigned within a statement "
+"while being assigned elsewhere in the modfile");
declare_symbol(name, eStatementDeclaredVariable, NULL, NULL);
declare_symbol(name, eStatementDeclaredVariable, nullptr, nullptr);
delete name;
}
......@@ -314,7 +314,7 @@ ParsingDriver::declare_optimal_policy_discount_factor_parameter(expr_t exprnode)
{
string *optimalParName_declare = new string("optimal_policy_discount_factor");
string *optimalParName_init = new string("optimal_policy_discount_factor");
declare_parameter(optimalParName_declare, NULL);
declare_parameter(optimalParName_declare, nullptr);
init_param(optimalParName_init, exprnode);
}
......@@ -327,10 +327,10 @@ ParsingDriver::begin_trend()
void
ParsingDriver::declare_trend_var(bool log_trend, string *name, string *tex_name)
{
declare_symbol(name, log_trend ? eLogTrend : eTrend, tex_name, NULL);
declare_symbol(name, log_trend ? eLogTrend : eTrend, tex_name, nullptr);
declared_trend_vars.push_back(mod_file->symbol_table.getID(*name));
delete name;
if (tex_name != NULL)
if (tex_name != nullptr)
delete tex_name;
}
......@@ -481,10 +481,10 @@ ParsingDriver::add_model_variable(int symb_id, int lag)
if (type == eModelLocalVariable && lag != 0)
error("Model local variable " + mod_file->symbol_table.getName(symb_id) + " cannot be given a lead or a lag.");
if (dynamic_cast<StaticModel *>(model_tree) != NULL && lag != 0)
if (dynamic_cast<StaticModel *>(model_tree) != nullptr && lag != 0)
error("Leads and lags on variables are forbidden in 'planner_objective'.");
if (dynamic_cast<StaticModel *>(model_tree) != NULL && type == eModelLocalVariable)
if (dynamic_cast<StaticModel *>(model_tree) != nullptr && type == eModelLocalVariable)
error("Model local variable " + mod_file->symbol_table.getName(symb_id) + " cannot be used in 'planner_objective'.");
// It makes sense to allow a lead/lag on parameters: during steady state calibration, endogenous and parameters can be swapped
......@@ -519,12 +519,12 @@ ParsingDriver::add_expression_variable(string *name)
void
ParsingDriver::declare_nonstationary_var(string *name, string *tex_name, vector<pair<string *, string *> *> *partition_value)
{
if (tex_name == NULL && partition_value == NULL)
if (tex_name == nullptr && partition_value == nullptr)
declare_endogenous(new string(*name));
else
if (tex_name == NULL)
declare_endogenous(new string(*name), NULL, partition_value);
else if (partition_value == NULL)
if (tex_name == nullptr)
declare_endogenous(new string(*name), nullptr, partition_value);
else if (partition_value == nullptr)
declare_endogenous(new string(*name), tex_name);
else
declare_endogenous(new string(*name), tex_name, partition_value);
......@@ -609,13 +609,13 @@ void
ParsingDriver::add_VAR_restriction_coeff(string *name1, string *name2, string *lagstr)
{
int symb_id1 = mod_file->symbol_table.getID(*name1);
int symb_id2 = name2 == NULL ? -1 : mod_file->symbol_table.getID(*name2);
int symb_id2 = name2 == nullptr ? -1 : mod_file->symbol_table.getID(*name2);
int lag = atoi(lagstr->c_str());
var_restriction_coeff = make_pair(symb_id1, make_pair(symb_id2, lag));
delete name1;
if (name2 != NULL)
if (name2 != nullptr)
delete name2;
delete lagstr;
}
......@@ -633,7 +633,7 @@ ParsingDriver::add_VAR_restriction_equation_or_crossequation(string *numberstr)
double number = atof(numberstr->c_str());
if (var_restriction_eq_or_crosseq.size() == 1)
var_restriction_equation_or_crossequation = make_pair(make_pair(var_restriction_eq_or_crosseq[0],
make_pair(make_pair(-1, make_pair(-1, -1)), (expr_t) NULL)),
make_pair(make_pair(-1, make_pair(-1, -1)), (expr_t) nullptr)),
number);
else
var_restriction_equation_or_crossequation = make_pair(make_pair(var_restriction_eq_or_crosseq[0],
......@@ -654,7 +654,7 @@ ParsingDriver::multiply_arg2_by_neg_one()
void
ParsingDriver::add_VAR_restriction_equation_or_crossequation_final(string *name)
{
if (name != NULL)
if (name != nullptr)
{
int symb_id = mod_file->symbol_table.getID(*name);
equation_restrictions[symb_id] = var_restriction_equation_or_crossequation;
......@@ -2576,7 +2576,7 @@ void
ParsingDriver::plot_conditional_forecast(string *periods)
{
int nperiods;
if (periods == NULL)
if (periods == nullptr)
nperiods = -1;
else
{
......@@ -2647,9 +2647,9 @@ ParsingDriver::add_model_equal_with_zero_rhs(expr_t arg)
void
ParsingDriver::declare_model_local_variable(string *name, string *tex_name)
{
declare_symbol(name, eModelLocalVariable, tex_name, NULL);
declare_symbol(name, eModelLocalVariable, tex_name, nullptr);
delete name;
if (tex_name != NULL)
if (tex_name != nullptr)
delete tex_name;
}
......@@ -3060,7 +3060,7 @@ ParsingDriver::external_function_option(const string &name_option, const string
{
if (opt.empty())
error("An argument must be passed to the 'name' option of the external_function() statement.");
declare_symbol(&opt, eExternalFunction, NULL, NULL);
declare_symbol(&opt, eExternalFunction, nullptr, nullptr);
current_external_function_id = mod_file->symbol_table.getID(opt);
}
else if (name_option == "first_deriv_provided")
......@@ -3069,7 +3069,7 @@ ParsingDriver::external_function_option(const string &name_option, const string