From 8bbc105fba8279aeefd5454de871ff20dd5aead6 Mon Sep 17 00:00:00 2001 From: sebastien Date: Wed, 29 Oct 2008 15:33:16 +0000 Subject: [PATCH] trunk preprocessor: for better compliance with C standard: * replaced all occurrences of "exit(-1)" by "exit(EXIT_FAILURE)" * return EXIT_SUCCESS at the end of main() git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@2229 ac1d8469-bf42-47a9-8791-bf33cf982152 --- preprocessor/BlockTriangular.cc | 12 +++---- preprocessor/ComputingTasks.cc | 2 +- preprocessor/DataTree.cc | 8 ++--- preprocessor/DynareFlex.ll | 2 +- preprocessor/DynareMain.cc | 4 +-- preprocessor/ExprNode.cc | 52 +++++++++++++++--------------- preprocessor/ModFile.cc | 12 +++---- preprocessor/ModelNormalization.cc | 2 +- preprocessor/ModelTree.cc | 24 +++++++------- preprocessor/Model_Graph.cc | 10 +++--- preprocessor/NumericalConstants.cc | 4 +-- preprocessor/ParsingDriver.cc | 2 +- preprocessor/SymbolGaussElim.cc | 28 ++++++++-------- preprocessor/VariableTable.cc | 2 +- preprocessor/macro/MacroDriver.cc | 4 +-- preprocessor/macro/MacroFlex.ll | 2 +- 16 files changed, 85 insertions(+), 85 deletions(-) diff --git a/preprocessor/BlockTriangular.cc b/preprocessor/BlockTriangular.cc index cbb60c6cd..b21c48c1f 100644 --- a/preprocessor/BlockTriangular.cc +++ b/preprocessor/BlockTriangular.cc @@ -130,7 +130,7 @@ BlockTriangular::bGet_IM(int lead_lag) const if((Cur_IM->lead_lag != lead_lag) || (Cur_IM==NULL)) { cout << "the incidence matrix with lag " << lead_lag << " does not exist !!"; - exit(-1); + exit(EXIT_FAILURE); } return (Cur_IM->IM); } @@ -148,7 +148,7 @@ BlockTriangular::fill_IM(int equation, int variable_endo, int lead_lag) { cout << "Error : The model has more equations (at least " << equation + 1 << ") than declared endogenous variables (" << endo_nbr << ")\n"; system("PAUSE"); - exit( -1); + exit(EXIT_FAILURE); } if (!Cur_IM) Cur_IM = Build_IM(lead_lag); @@ -167,7 +167,7 @@ BlockTriangular::unfill_IM(int equation, int variable_endo, int lead_lag) { cout << "Error : The model has more equations (at least " << equation + 1 << ") than declared endogenous variables (" << endo_nbr << ")\n"; system("PAUSE"); - exit( -1); + exit(EXIT_FAILURE); }*/ if (!Cur_IM) Cur_IM = Build_IM(lead_lag); @@ -409,7 +409,7 @@ BlockTriangular::Allocate_Block(int size, int *count_Equ, int *count_Block, Bloc if(IM == NULL) { cout << "Error IM(" << li - Lag << ") doesn't exist\n"; - exit( -1); + exit(EXIT_FAILURE); } if(IM[Index_Var_IM[*count_Equ].index + Index_Equ_IM[*count_Equ].index*endo_nbr] && nb_lead_lag_endo) { @@ -564,7 +564,7 @@ BlockTriangular::Allocate_Block(int size, int *count_Equ, int *count_Block, Bloc else { cout << "Error IM(" << i - Lag << ") doesn't exist\n"; - exit( -1); + exit(EXIT_FAILURE); } for(j = first_count_equ;j < size + first_count_equ;j++) { @@ -809,7 +809,7 @@ BlockTriangular::Normalize_and_BlockDecompose(bool* IM, Model_Block* ModelBlock, normalization.Set_fp_verbose(true); OK=normalization.Normalize(n, *prologue, *epilogue, SIM00, Index_Equ_IM, Equation_gr, 1, IM); cout << "Error\n"; - exit(-1); + exit(EXIT_FAILURE); } } else diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc index 3c070ec73..23e4973a8 100644 --- a/preprocessor/ComputingTasks.cc +++ b/preprocessor/ComputingTasks.cc @@ -832,7 +832,7 @@ PlannerObjectiveStatement::checkPass(ModFileStructure &mod_file_struct) if (model_tree->equation_number() != 1) { cerr << "ERROR: planer_objective: should have only one equation!" << endl; - exit(-1); + exit(EXIT_FAILURE); } } diff --git a/preprocessor/DataTree.cc b/preprocessor/DataTree.cc index 4579db474..487646ac9 100644 --- a/preprocessor/DataTree.cc +++ b/preprocessor/DataTree.cc @@ -163,7 +163,7 @@ DataTree::AddDivide(NodeID iArg1, NodeID iArg2) else { cerr << "Division by zero!" << endl; - exit(-1); + exit(EXIT_FAILURE); } } @@ -235,7 +235,7 @@ DataTree::AddLog(NodeID iArg1) else { cerr << "log(0) isn't available" << endl; - exit(-1); + exit(EXIT_FAILURE); } } @@ -248,7 +248,7 @@ NodeID DataTree::AddLog10(NodeID iArg1) else { cerr << "log10(0) isn't available" << endl; - exit(-1); + exit(EXIT_FAILURE); } } @@ -412,7 +412,7 @@ DataTree::AddUnknownFunction(const string &function_name, const vector & if (symbol_table.getType(function_name) != eUnknownFunction) { cerr << "Symbol " << function_name << " is not a function name!"; - exit(-1); + exit(EXIT_FAILURE); } int id = symbol_table.getID(function_name); diff --git a/preprocessor/DynareFlex.ll b/preprocessor/DynareFlex.ll index a7df257fc..e64d6fc60 100644 --- a/preprocessor/DynareFlex.ll +++ b/preprocessor/DynareFlex.ll @@ -433,7 +433,7 @@ int DynareFlexLexer::yylex() { cerr << "DynareFlexLexer::yylex() has been called, that should never happen!" << endl; - exit(-1); + exit(EXIT_FAILURE); } /* diff --git a/preprocessor/DynareMain.cc b/preprocessor/DynareMain.cc index 832bd0d41..b571a3a87 100644 --- a/preprocessor/DynareMain.cc +++ b/preprocessor/DynareMain.cc @@ -83,7 +83,7 @@ main(int argc, char** argv) if (ext != string(".mod") && ext != string(".dyn")) { cerr << "mod_file extension must be .mod or .dyn!" << endl; - exit(-1); + exit(EXIT_FAILURE); } basename.erase(basename.size() - 4, 4); @@ -102,5 +102,5 @@ main(int argc, char** argv) // Do the rest main2(macro_output, basename, debug, clear_all, no_tmp_terms); - return 0; + return EXIT_SUCCESS; } diff --git a/preprocessor/ExprNode.cc b/preprocessor/ExprNode.cc index f978044f7..592b5d213 100644 --- a/preprocessor/ExprNode.cc +++ b/preprocessor/ExprNode.cc @@ -185,7 +185,7 @@ VariableNode::VariableNode(DataTree &datatree_arg, int symb_id_arg, SymbolType t if ((type == eModelLocalVariable || type == eModFileLocalVariable || type == eUnknownFunction) && lag != 0) { cerr << "Attempt to construct a VariableNode for local variable or unknown function with non-zero lead/lag" << endl; - exit(-1); + exit(EXIT_FAILURE); } // Fill in non_null_derivatives @@ -209,7 +209,7 @@ VariableNode::VariableNode(DataTree &datatree_arg, int symb_id_arg, SymbolType t break; case eUnknownFunction: cerr << "Attempt to construct a VariableNode with an unknown function name" << endl; - exit(-1); + exit(EXIT_FAILURE); } } @@ -231,13 +231,13 @@ VariableNode::computeDerivative(int varID) return datatree.local_variables_table[symb_id]->getDerivative(varID); case eModFileLocalVariable: cerr << "ModFileLocalVariable is not derivable" << endl; - exit(-1); + exit(EXIT_FAILURE); case eUnknownFunction: cerr << "Impossible case!" << endl; - exit(-1); + exit(EXIT_FAILURE); } cerr << "Impossible case!" << endl; - exit(-1); + exit(EXIT_FAILURE); } void @@ -343,7 +343,7 @@ VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type, if (lag != 0) { cerr << "VariableNode::writeOutput: lag != 0 for exogenous variable outside model scope!" << endl; - exit(-1); + exit(EXIT_FAILURE); } output << "oo_.exo_steady_state" << "(" << i << ")"; break; @@ -381,7 +381,7 @@ VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type, if (lag != 0) { cerr << "VariableNode::writeOutput: lag != 0 for exogenous determistic variable outside model scope!" << endl; - exit(-1); + exit(EXIT_FAILURE); } output << "oo_.exo_det_steady_state" << "(" << symb_id + 1 << ")"; break; @@ -390,7 +390,7 @@ VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type, case eUnknownFunction: cerr << "Impossible case" << endl; - exit(-1); + exit(EXIT_FAILURE); } } @@ -459,10 +459,10 @@ VariableNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType ou case eModelLocalVariable: case eModFileLocalVariable: cerr << "VariableNode::compile: unhandled variable type" << endl; - exit(-1); + exit(EXIT_FAILURE); case eUnknownFunction: cerr << "Impossible case" << endl; - exit(-1); + exit(EXIT_FAILURE); } } @@ -552,7 +552,7 @@ UnaryOpNode::computeDerivative(int varID) return datatree.AddDivide(darg, t11); } cerr << "Impossible case!" << endl; - exit(-1); + exit(EXIT_FAILURE); } int @@ -637,7 +637,7 @@ UnaryOpNode::cost(const temporary_terms_type &temporary_terms, bool is_matlab) c return cost + 90; } cerr << "Impossible case!" << endl; - exit(-1); + exit(EXIT_FAILURE); } void @@ -951,7 +951,7 @@ BinaryOpNode::computeDerivative(int varID) return datatree.AddMinus(darg1, darg2); } cerr << "Impossible case!" << endl; - exit(-1); + exit(EXIT_FAILURE); } int @@ -991,7 +991,7 @@ BinaryOpNode::precedence(ExprNodeOutputType output_type, const temporary_terms_t return 100; } cerr << "Impossible case!" << endl; - exit(-1); + exit(EXIT_FAILURE); } int @@ -1056,7 +1056,7 @@ BinaryOpNode::cost(const temporary_terms_type &temporary_terms, bool is_matlab) return cost; } cerr << "Impossible case!" << endl; - exit(-1); + exit(EXIT_FAILURE); } void @@ -1153,7 +1153,7 @@ BinaryOpNode::eval_opcode(double v1, BinaryOpcode op_code, double v2) throw (Eva throw EvalException(); } cerr << "Impossible case!" << endl; - exit(-1); + exit(EXIT_FAILURE); } double @@ -1399,7 +1399,7 @@ TrinaryOpNode::computeDerivative(int varID) return datatree.AddTimes(t11, t15); } cerr << "Impossible case!" << endl; - exit(-1); + exit(EXIT_FAILURE); } int @@ -1416,7 +1416,7 @@ TrinaryOpNode::precedence(ExprNodeOutputType output_type, const temporary_terms_ return 100; } cerr << "Impossible case!" << endl; - exit(-1); + exit(EXIT_FAILURE); } int @@ -1445,7 +1445,7 @@ TrinaryOpNode::cost(const temporary_terms_type &temporary_terms, bool is_matlab) return cost+1000; } cerr << "Impossible case!" << endl; - exit(-1); + exit(EXIT_FAILURE); } void @@ -1510,10 +1510,10 @@ TrinaryOpNode::eval_opcode(double v1, TrinaryOpcode op_code, double v2, double v { case oNormcdf: cerr << "NORMCDF: eval not implemented" << endl; - exit(-1); + exit(EXIT_FAILURE); } cerr << "Impossible case!" << endl; - exit(-1); + exit(EXIT_FAILURE); } double @@ -1554,7 +1554,7 @@ TrinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type, if (!OFFSET(output_type)) { cerr << "TrinaryOpNode not implemented for C output" << endl; - exit(-1); + exit(EXIT_FAILURE); } // If current node is a temporary term @@ -1603,7 +1603,7 @@ NodeID UnknownFunctionNode::computeDerivative(int varID) { cerr << "UnknownFunctionNode::computeDerivative: operation impossible!" << endl; - exit(-1); + exit(EXIT_FAILURE); } void @@ -1612,7 +1612,7 @@ UnknownFunctionNode::computeTemporaryTerms(map &reference_count, bool is_matlab) const { cerr << "UnknownFunctionNode::computeTemporaryTerms: operation impossible!" << endl; - exit(-1); + exit(EXIT_FAILURE); } void UnknownFunctionNode::writeOutput(ostream &output, ExprNodeOutputType output_type, @@ -1639,7 +1639,7 @@ UnknownFunctionNode::computeTemporaryTerms(map &reference_count, map_idx_type &map_idx) const { cerr << "UnknownFunctionNode::computeTemporaryTerms: not implemented" << endl; - exit(-1); + exit(EXIT_FAILURE); } void @@ -1660,5 +1660,5 @@ void UnknownFunctionNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const { cerr << "UnknownFunctionNode::compile: operation impossible!" << endl; - exit(-1); + exit(EXIT_FAILURE); } diff --git a/preprocessor/ModFile.cc b/preprocessor/ModFile.cc index 6997ee50f..495b030a2 100644 --- a/preprocessor/ModFile.cc +++ b/preprocessor/ModFile.cc @@ -66,13 +66,13 @@ ModFile::checkPass() || stochastic_statement_present)) { cerr << "ERROR: At least one model equation must be declared!" << endl; - exit(-1); + exit(EXIT_FAILURE); } if (mod_file_struct.simul_present && stochastic_statement_present) { cerr << "ERROR: A .mod file cannot contain both a simul command and one of {stoch_simul, estimation, forecast, osr, ramsey_policy}" << endl; - exit(-1); + exit(EXIT_FAILURE); } /* @@ -86,7 +86,7 @@ ModFile::checkPass() && (model_tree.equation_number() != symbol_table.endo_nbr)) { cerr << "ERROR: There are " << model_tree.equation_number() << " equations but " << symbol_table.endo_nbr << " endogenous variables!" << endl; - exit(-1); + exit(EXIT_FAILURE); } } @@ -104,7 +104,7 @@ ModFile::computingPass(bool no_tmp_terms) if (mod_file_struct.order_option < 1 || mod_file_struct.order_option > 3) { cerr << "Incorrect order option..." << endl; - exit(-1); + exit(EXIT_FAILURE); } model_tree.computeJacobianExo = true; if (mod_file_struct.order_option >= 2) @@ -135,13 +135,13 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all) const { cerr << "ERROR: Can't open file " << fname << " for writing" << endl; - exit(-1); + exit(EXIT_FAILURE); } } else { cerr << "ERROR: Missing file name" << endl; - exit(-1); + exit(EXIT_FAILURE); } mOutputFile << "%" << endl diff --git a/preprocessor/ModelNormalization.cc b/preprocessor/ModelNormalization.cc index 75dfe62b5..039fd2cfe 100644 --- a/preprocessor/ModelNormalization.cc +++ b/preprocessor/ModelNormalization.cc @@ -535,7 +535,7 @@ Normalization::Normalize(int n, int prologue, int epilogue, bool* IM, simple* In cout << "\n could not be normalized\n"; //ErrorHandling(n, IM, Index_Equ_IM); //system("PAUSE"); - exit( -1); + exit(EXIT_FAILURE); } if(matchingSize >= effective_n ) { diff --git a/preprocessor/ModelTree.cc b/preprocessor/ModelTree.cc index 513a2e4fc..59fda0327 100644 --- a/preprocessor/ModelTree.cc +++ b/preprocessor/ModelTree.cc @@ -1002,7 +1002,7 @@ ModelTree::writeModelEquationsCodeOrdered(const string file_name, const Model_Bl if (!code_file.is_open()) { cout << "Error : Can't open file \"" << main_name << "\" for writing\n"; - exit( -1); + exit(EXIT_FAILURE); } //Temporary variables declaration code_file.write(&FDIMT, sizeof(FDIMT)); @@ -1366,7 +1366,7 @@ ModelTree::writeStaticMFile(const string &static_basename) const if (!mStaticModelFile.is_open()) { cerr << "Error: Can't open file " << filename << " for writing" << endl; - exit(-1); + exit(EXIT_FAILURE); } // Writing comments and function definition command mStaticModelFile << "function [residual, g1, g2] = " << static_basename << "(y, x, params)" << endl @@ -1392,7 +1392,7 @@ ModelTree::writeDynamicMFile(const string &dynamic_basename) const if (!mDynamicModelFile.is_open()) { cerr << "Error: Can't open file " << filename << " for writing" << endl; - exit(-1); + exit(EXIT_FAILURE); } mDynamicModelFile << "function [residual, g1, g2, g3] = " << dynamic_basename << "(y, x, params, it_)" << endl << "%" << endl @@ -1416,7 +1416,7 @@ ModelTree::writeStaticCFile(const string &static_basename) const if (!mStaticModelFile.is_open()) { cerr << "Error: Can't open file " << filename << " for writing" << endl; - exit(-1); + exit(EXIT_FAILURE); } mStaticModelFile << "/*" << endl << " * " << filename << " : Computes static model for Dynare" << endl @@ -1481,7 +1481,7 @@ ModelTree::writeDynamicCFile(const string &dynamic_basename) const if (!mDynamicModelFile.is_open()) { cerr << "Error: Can't open file " << filename << " for writing" << endl; - exit(-1); + exit(EXIT_FAILURE); } mDynamicModelFile << "/*" << endl << " * " << filename << " : Computes dynamic model for Dynare" << endl @@ -1723,7 +1723,7 @@ ModelTree::Write_Inf_To_Bin_File(const string &dynamic_basename, const string &b if (!SaveCode.is_open()) { cout << "Error : Can't open file \"" << bin_basename << ".bin\" for writing\n"; - exit( -1); + exit(EXIT_FAILURE); } u_count_int=0; for(int m=0;m<=block_triangular.ModelBlock->Block_List[num].Max_Lead+block_triangular.ModelBlock->Block_List[num].Max_Lag;m++) @@ -1782,7 +1782,7 @@ ModelTree::writeSparseStaticMFile(const string &static_basename, const string &b if (!mStaticModelFile.is_open()) { cerr << "Error: Can't open file " << filename << " for writing" << endl; - exit(-1); + exit(EXIT_FAILURE); } mStaticModelFile << "%\n"; mStaticModelFile << "% " << filename << " : Computes static model for Dynare\n"; @@ -2001,7 +2001,7 @@ ModelTree::writeSparseDynamicMFile(const string &dynamic_basename, const string if (!mDynamicModelFile.is_open()) { cerr << "Error: Can't open file " << filename << " for writing" << endl; - exit(-1); + exit(EXIT_FAILURE); } mDynamicModelFile << "%\n"; mDynamicModelFile << "% " << filename << " : Computes dynamic model for Dynare\n"; @@ -2308,7 +2308,7 @@ ModelTree::writeSparseDynamicMFile(const string &dynamic_basename, const string block_triangular.ModelBlock->Block_List[i].IM_lead_lag[block_triangular.ModelBlock->Block_List[i].Max_Lag + block_triangular.ModelBlock->Block_List[i].Max_Lead].u_finish + 1 << ", " << symbol_table.endo_nbr << ", " << block_triangular.ModelBlock->Block_List[i].Max_Lag << ", " << block_triangular.ModelBlock->Block_List[i].Max_Lead << ");\n"; cerr << "Not implemented block SOLVE_TWO_BOUNDARIES_COMPLETE" << endl; - exit(-1); + exit(EXIT_FAILURE); }*/ else if ((k == SOLVE_FORWARD_COMPLETE) && (block_triangular.ModelBlock->Block_List[i].Size)) { @@ -2349,7 +2349,7 @@ ModelTree::writeSparseDynamicMFile(const string &dynamic_basename, const string mDynamicModelFile << " end\n"; mDynamicModelFile << " end\n"; /*cerr << "Not implemented block SOLVE_FORWARD_COMPLETE" << endl; - exit(-1);*/ + exit(EXIT_FAILURE);*/ } else if ((k == SOLVE_BACKWARD_COMPLETE) && (block_triangular.ModelBlock->Block_List[i].Size)) { @@ -2386,7 +2386,7 @@ ModelTree::writeSparseDynamicMFile(const string &dynamic_basename, const string mDynamicModelFile << " end\n"; mDynamicModelFile << " end\n"; /*cerr << "Not implemented block SOLVE_BACKWARD_COMPLETE" << endl; - exit(-1);*/ + exit(EXIT_FAILURE);*/ } else if ((k == SOLVE_TWO_BOUNDARIES_COMPLETE || k == SOLVE_TWO_BOUNDARIES_SIMPLE) && (block_triangular.ModelBlock->Block_List[i].Size)) { @@ -3012,7 +3012,7 @@ ModelTree::addEquation(NodeID eq) if (beq == NULL || beq->op_code != oEqual) { cerr << "ModelTree::addEquation: you didn't provide an equal node!" << endl; - exit(-1); + exit(EXIT_FAILURE); } equations.push_back(beq); diff --git a/preprocessor/Model_Graph.cc b/preprocessor/Model_Graph.cc index bd93d5478..40fdc7fb3 100644 --- a/preprocessor/Model_Graph.cc +++ b/preprocessor/Model_Graph.cc @@ -90,14 +90,14 @@ void Check_Graph(t_model_graph* model_graph) cout << "not symetric for edge between vertices " << model_graph->vertex[i1].index << " and " << model_graph->vertex[i].index << " (in_degree)\n"; print_Graph(model_graph); system("pause"); - exit( -1); + exit(EXIT_FAILURE); } if(!OK_u_count) { cout << "valeur de u_count non symétrique sur l'arc entre " << model_graph->vertex[i1].index << " et " << model_graph->vertex[i].index << " (in_degree)\n"; print_Graph(model_graph); system("pause"); - exit( -1); + exit(EXIT_FAILURE); } } for(j = 0;j < model_graph->vertex[i].nb_out_degree_edges;j++) @@ -120,14 +120,14 @@ void Check_Graph(t_model_graph* model_graph) cout << "pas symétrique sur l'arc entre " << model_graph->vertex[i1].index << " et " << model_graph->vertex[i].index << " (out_degree)\n"; print_Graph(model_graph); system("pause"); - exit( -1); + exit(EXIT_FAILURE); } if(!OK_u_count) { cout << "valeur de u_count non symétrique sur l'arc entre " << model_graph->vertex[i1].index << " et " << model_graph->vertex[i].index << " (out_degree)\n"; print_Graph(model_graph); system("pause"); - exit( -1); + exit(EXIT_FAILURE); } } } @@ -361,7 +361,7 @@ ModelBlock_Graph(Model_Block *ModelBlock, int Blck_num, bool dynamic, t_model_gr { cout << "Error in model graph construction (lead part): j (" << j << ")>size (" << ModelBlock->Block_List[Blck_num].IM_lead_lag[lag1].size << ")\n"; system("pause"); - exit(-1); + exit(EXIT_FAILURE); } //#endif vertex_index[k2] = (lag + *periods - 1) * nb_endo + ModelBlock->Block_List[Blck_num].IM_lead_lag[lag1].Var_Index[j]; diff --git a/preprocessor/NumericalConstants.cc b/preprocessor/NumericalConstants.cc index b17701dad..7f7430231 100644 --- a/preprocessor/NumericalConstants.cc +++ b/preprocessor/NumericalConstants.cc @@ -39,7 +39,7 @@ NumericalConstants::AddConstant(const string &iConst) if (atof(iConst.c_str()) < 0) { cerr << "Can't handle a negative constant..!" << endl; - exit(-1); + exit(EXIT_FAILURE); } int id = (int) mNumericalConstants.size(); @@ -56,7 +56,7 @@ NumericalConstants::get(int ID) const else { cerr << "Unknown constant" << endl; - exit(-1); + exit(EXIT_FAILURE); } } diff --git a/preprocessor/ParsingDriver.cc b/preprocessor/ParsingDriver.cc index cd2cd3138..dcd1b6d34 100644 --- a/preprocessor/ParsingDriver.cc +++ b/preprocessor/ParsingDriver.cc @@ -78,7 +78,7 @@ void ParsingDriver::error(const Dynare::parser::location_type &l, const string &m) { cerr << "ERROR: " << l << ": " << m << endl; - exit(-1); + exit(EXIT_FAILURE); } void diff --git a/preprocessor/SymbolGaussElim.cc b/preprocessor/SymbolGaussElim.cc index f9d14ea33..f4d3452d9 100644 --- a/preprocessor/SymbolGaussElim.cc +++ b/preprocessor/SymbolGaussElim.cc @@ -60,7 +60,7 @@ SymbolicGaussElimination::set_free_u_list(int index) { cout << "Error to much j=" << j << " Maximum allowed=" << MAX_FREE_U_LIST << "\n"; system("pause"); - exit( -1); + exit(EXIT_FAILURE); } } } @@ -68,7 +68,7 @@ SymbolicGaussElimination::set_free_u_list(int index) { cout << "Error to much i=" << i << " Maximum allowed=" << MAX_FREE_U_LIST << "\n"; system("pause"); - exit( -1); + exit(EXIT_FAILURE); } free_u_list[i] = index; nb_free_u_list++; @@ -76,7 +76,7 @@ SymbolicGaussElimination::set_free_u_list(int index) { cout << "Error to much free_u_list=" << nb_free_u_list << " Maximum allowed=" << MAX_FREE_U_LIST << "\n"; system("pause"); - exit( -1); + exit(EXIT_FAILURE); } if(nb_free_u_list > max_nb_free_u_list) max_nb_free_u_list = nb_free_u_list; @@ -281,7 +281,7 @@ store_code(t_table_u **save_table_u, t_table_u *First_table_u, t_table_u *stop_t if((table_u->type > 7) || (table_u->type < 1)) { cout << "Error : table_u->type=" << int(table_u->type) << " *nb_save_table_u=" << *nb_save_table_u << "\n"; - exit( -1); + exit(EXIT_FAILURE); } else { @@ -489,7 +489,7 @@ SymbolicGaussElimination::interpolation(t_model_graph* model_graph, t_table_y* t cout << "first_u_blck=" << first_u_blck << " second_u_blck=" << second_u_blck << "\n"; cout << "c_first_table_u->type=" << int(c_first_table_u->type) << " c_second_table_u->type=" << int(c_second_table_u->type) << "\n"; system("pause"); - exit( -1); + exit(EXIT_FAILURE); } switch (c_first_table_u->type) { @@ -606,7 +606,7 @@ SymbolicGaussElimination::interpolation(t_model_graph* model_graph, t_table_y* t { cout << "c_first_table_u->pNext=" << c_first_table_u->pNext << " second_u_blck->pNext=" << second_u_blck->pNext << "\n"; cout << "Error not synchronize graph interpolation\n"; - exit( -1); + exit(EXIT_FAILURE); } OK = 0; } @@ -821,7 +821,7 @@ SymbolicGaussElimination::Loop_Elimination(t_model_graph* model_graph) cout << "Error: not symetric on a loop on vertex " << model_graph->vertex[i].index << "\n"; print_Graph(model_graph); system("pause"); - exit( -1); + exit(EXIT_FAILURE); } for(j = pos + 1;j < model_graph->vertex[i].nb_out_degree_edges;j++) { @@ -839,7 +839,7 @@ SymbolicGaussElimination::Loop_Elimination(t_model_graph* model_graph) cout << "Error: not symetric on a loop on vertex " << model_graph->vertex[i].index << "\n"; print_Graph(model_graph); system("pause"); - exit( -1); + exit(EXIT_FAILURE); } for(j = pos + 1;j < model_graph->vertex[i].nb_in_degree_edges;j++) { @@ -988,7 +988,7 @@ SymbolicGaussElimination::Vertex_Elimination(t_model_graph* model_graph, int pos if(a_loop >= size) { cout << "Error : a_loop (" << a_loop << ") >= " << size << "\n"; - exit( -1); + exit(EXIT_FAILURE); } s_j2[a_loop] = j2; s_i2[a_loop] = i2; @@ -1113,7 +1113,7 @@ SymbolicGaussElimination::Vertex_Elimination(t_model_graph* model_graph, int pos cout << "error: Model_Graph not correctly filled in out_degree (edge from " << lvertex[i1].index << " to " << lvertex[vertex_to_eliminate].index << ")\n"; print_Graph(model_graph); system("pause"); - exit( -1); + exit(EXIT_FAILURE); } #ifdef SIMPLIFYS nb_free++; @@ -1151,7 +1151,7 @@ SymbolicGaussElimination::Vertex_Elimination(t_model_graph* model_graph, int pos cout << "error: Model_Graph not correctly filled in in_degree (edge from " << lvertex[vertex_to_eliminate].index << " to " << lvertex[j1].index << ")\n"; print_Graph(model_graph); system("pause"); - exit( -1); + exit(EXIT_FAILURE); } #ifdef SIMPLIFYS set_free_u_list(lvertex[j1].in_degree_edge[to_add].u_count); @@ -1193,7 +1193,7 @@ SymbolicGaussElimination::Vertex_Elimination(t_model_graph* model_graph, int pos cout << "loop_table_vertex_index[" << k << "]=" << loop_table_vertex_index[k] << " =? model_graph->vertex[" << i1 << "].index=" << model_graph->vertex[i1].index << "\n"; k++; } - exit( -1); + exit(EXIT_FAILURE); } curr_u_count = loop_table_u_count[k] ; } @@ -1361,7 +1361,7 @@ SymbolicGaussElimination::Gaussian_Elimination(t_model_graph* model_graph if(!SaveCode.is_open()) { cout << "Error : Can't open file \"" << file_name << ".bin\" for writing\n"; - exit( -1); + exit(EXIT_FAILURE); } #ifdef PRINT_OUT print_Graph(model_graph); @@ -1674,7 +1674,7 @@ SymbolicGaussElimination::Gaussian_Elimination(t_model_graph* model_graph if((nstacked)&&(!nb_last_save_table_y)) { cout << "not synchronized per=" << per << "\n"; - exit(-1); + exit(EXIT_FAILURE); } #ifdef PRINT_OUT diff --git a/preprocessor/VariableTable.cc b/preprocessor/VariableTable.cc index ccf523fe6..d57fcfd65 100644 --- a/preprocessor/VariableTable.cc +++ b/preprocessor/VariableTable.cc @@ -80,7 +80,7 @@ VariableTable::addVariable(SymbolType type, int symb_id, int lag) throw (DynJaco break; default: cerr << "VariableTable::addVariable(): forbidden variable type" << endl; - exit(-1); + exit(EXIT_FAILURE); } return var_id; } diff --git a/preprocessor/macro/MacroDriver.cc b/preprocessor/macro/MacroDriver.cc index adfc596c1..b8d6f9d4e 100644 --- a/preprocessor/macro/MacroDriver.cc +++ b/preprocessor/macro/MacroDriver.cc @@ -43,7 +43,7 @@ MacroDriver::parse(const string &f, ostream &out, bool debug) if (in.fail()) { cerr << "ERROR: Could not open file: " << f << endl; - exit(-1); + exit(EXIT_FAILURE); } lexer = new MacroFlex(&in, &out); @@ -60,7 +60,7 @@ void MacroDriver::error(const Macro::parser::location_type &l, const string &m) const { cerr << "ERROR in macro-processor: " << l << ": " << m << endl; - exit(-1); + exit(EXIT_FAILURE); } void diff --git a/preprocessor/macro/MacroFlex.ll b/preprocessor/macro/MacroFlex.ll index df7e1c5fe..d74ab0640 100644 --- a/preprocessor/macro/MacroFlex.ll +++ b/preprocessor/macro/MacroFlex.ll @@ -408,7 +408,7 @@ int MacroFlexLexer::yylex() { cerr << "MacroFlexLexer::yylex() has been called, that should never happen!" << endl; - exit(-1); + exit(EXIT_FAILURE); } /*