From c079ace8c3185fded3fa260e464f15912be1dbd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien.villemot@ens.fr> Date: Fri, 8 Jun 2012 19:00:57 +0200 Subject: [PATCH] Remove various compiler warnings --- dynare++/src/nlsolve.cpp | 4 +--- mex/sources/block_kalman_filter/block_kalman_filter.cc | 5 ++--- mex/sources/bytecode/SparseMatrix.cc | 4 ++++ .../local_state_space_iteration_2.cc | 2 +- mex/sources/mjdgges/mjdgges.c | 5 ++--- mex/sources/sobol/qmc_sequence.cc | 4 ++-- preprocessor/MinimumFeedbackSet.cc | 3 +-- preprocessor/StaticModel.cc | 4 +--- 8 files changed, 14 insertions(+), 17 deletions(-) diff --git a/dynare++/src/nlsolve.cpp b/dynare++/src/nlsolve.cpp index c335d8fde7..1210176b3f 100644 --- a/dynare++/src/nlsolve.cpp +++ b/dynare++/src/nlsolve.cpp @@ -21,7 +21,7 @@ double GoldenSectionSearch::search(OneDFunction& f, double x1, double x2) if (init_bracket(f, x1, x2, b)) { double fb = f.eval(b); double f1 = f.eval(x1); - double f2 = f.eval(x2); + f.eval(x2); double dx; do { double w = (b-x1)/(x2-x1); @@ -38,7 +38,6 @@ double GoldenSectionSearch::search(OneDFunction& f, double x1, double x2) // x is on the left from b if (f1 > fx && fx < fb) { // pickup bracket [f1,fx,fb] - f2 = fb; x2 = b; fb = fx; b = x; @@ -51,7 +50,6 @@ double GoldenSectionSearch::search(OneDFunction& f, double x1, double x2) // x is on the right from b if (f1 > fb && fb < fx) { // pickup bracket [f1,fb,fx] - f2 = fx; x2 = x; } else { // pickup bracket [fb,fx,f2] diff --git a/mex/sources/block_kalman_filter/block_kalman_filter.cc b/mex/sources/block_kalman_filter/block_kalman_filter.cc index d8b317d001..13fde7525a 100644 --- a/mex/sources/block_kalman_filter/block_kalman_filter.cc +++ b/mex/sources/block_kalman_filter/block_kalman_filter.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 Dynare Team + * Copyright (C) 2007-2012 Dynare Team * * This file is part of Dynare. * @@ -247,7 +247,6 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) for (int i = 0; i < n; i++) i_nz_state_var[i] = nz_state_var[i]; - int n_diag = mxGetScalar(prhs[11]); #else mxArray *M_; M_ = mexGetVariable("global", "M_"); @@ -342,7 +341,7 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) lapack_int* iw = (lapack_int*)mxMalloc(pp * sizeof(lapack_int)); lapack_int* ipiv = (lapack_int*)mxMalloc(pp * sizeof(lapack_int)); lapack_int info = 0; - double anorm, rcond; + double rcond; #ifdef BLAS mxArray* p_P_t_t1 = mxCreateDoubleMatrix(n, n, mxREAL); #else diff --git a/mex/sources/bytecode/SparseMatrix.cc b/mex/sources/bytecode/SparseMatrix.cc index 57b14bfb8a..d7c4ab466c 100644 --- a/mex/sources/bytecode/SparseMatrix.cc +++ b/mex/sources/bytecode/SparseMatrix.cc @@ -3001,11 +3001,15 @@ SparseMatrix::Simulate_Newton_One_Boundary(int blck, int y_size, int it_, int y_ { for (j = 0; j < y_size; j++) { +#ifdef DEBUG bool select = false; +#endif for (int i = 0; i < Size; i++) if (j == index_vara[i]) { +#ifdef DEBUG select = true; +#endif break; } #ifdef DEBUG diff --git a/mex/sources/local_state_space_iterations/local_state_space_iteration_2.cc b/mex/sources/local_state_space_iterations/local_state_space_iteration_2.cc index 6943b782b5..3e29981839 100644 --- a/mex/sources/local_state_space_iterations/local_state_space_iteration_2.cc +++ b/mex/sources/local_state_space_iterations/local_state_space_iteration_2.cc @@ -310,7 +310,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) double *ghxx = mxGetPr(prhs[5]); double *ghuu = mxGetPr(prhs[6]); double *ghxu = mxGetPr(prhs[7]); - double *yhat_, *ss; + double *yhat_ = NULL, *ss = NULL; if (nrhs>9) { yhat_ = mxGetPr(prhs[8]); diff --git a/mex/sources/mjdgges/mjdgges.c b/mex/sources/mjdgges/mjdgges.c index 2237ce292b..145439bb9d 100644 --- a/mex/sources/mjdgges/mjdgges.c +++ b/mex/sources/mjdgges/mjdgges.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2011 Dynare Team + * Copyright (C) 2006-2012 Dynare Team * * This file is part of Dynare. * @@ -34,12 +34,11 @@ my_criteria(const double *alphar, const double *alphai, const double *beta) void mjdgges(double *a, double *b, double *z, double *n, double *sdim, double *eval_r, double *eval_i, double *info) { - lapack_int i_n, i_info, i_sdim, one, lwork; + lapack_int i_n, i_info, i_sdim, lwork; double *alphar, *alphai, *beta, *work, *par, *pai, *pb, *per, *pei; double *junk; lapack_int *bwork; - one = 1; i_n = (lapack_int)*n; alphar = mxCalloc(i_n, sizeof(double)); alphai = mxCalloc(i_n, sizeof(double)); diff --git a/mex/sources/sobol/qmc_sequence.cc b/mex/sources/sobol/qmc_sequence.cc index 0eddd734d4..04e4a567f0 100644 --- a/mex/sources/sobol/qmc_sequence.cc +++ b/mex/sources/sobol/qmc_sequence.cc @@ -1,7 +1,7 @@ /* ** Computes Quasi Monte-Carlo sequence. ** -** Copyright (C) 2010-2011 Dynare Team +** Copyright (C) 2010-2012 Dynare Team ** ** This file is part of Dynare (can be used outside Dynare). ** @@ -135,7 +135,7 @@ void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { DYN_MEX_FUNC_ERR_MSG_TXT("qmc_sequence:: The fifth input argument must be a positive scalar!"); } - double *lower_bounds, *upper_bounds; + double *lower_bounds = NULL, *upper_bounds = NULL; int unit_hypercube_flag = 1; if ( (type==0) && (nrhs>4) ) { diff --git a/preprocessor/MinimumFeedbackSet.cc b/preprocessor/MinimumFeedbackSet.cc index c43562f04f..479c8f227c 100644 --- a/preprocessor/MinimumFeedbackSet.cc +++ b/preprocessor/MinimumFeedbackSet.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2011 Dynare Team + * Copyright (C) 2009-2012 Dynare Team * * This file is part of Dynare. * @@ -226,7 +226,6 @@ namespace MFS bool not_a_loop; int i; AdjacencyList_t::vertex_iterator it, it1, ita, it_end; - property_map<AdjacencyList_t, vertex_index_t>::type v_index = get(vertex_index, G); for (tie(it, it_end) = vertices(G), i = 0; it != it_end; ++it, i++) { int in_degree_n = in_degree(*it, G); diff --git a/preprocessor/StaticModel.cc b/preprocessor/StaticModel.cc index 9f9f0a0659..57b13bea79 100644 --- a/preprocessor/StaticModel.cc +++ b/preprocessor/StaticModel.cc @@ -1515,12 +1515,10 @@ StaticModel::writeOutput(ostream &output, bool block) const { BlockSimulationType simulation_type = getBlockSimulationType(b); unsigned int block_size = getBlockSize(b); - unsigned int block_mfs = getBlockMfs(b); - unsigned int block_recursive = block_size - block_mfs; ostringstream tmp_s, tmp_s_eq; tmp_s.str(""); tmp_s_eq.str(""); - for (int i = 0; i < block_size; i++) + for (unsigned int i = 0; i < block_size; i++) { tmp_s << " " << getBlockVariableID(b, i)+1; tmp_s_eq << " " << getBlockEquationID(b, i)+1; -- GitLab