From cd3579d6fe79da7b795efefbdf0010c04f62c8b9 Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 28 Jun 2012 22:43:19 +0000 Subject: [PATCH] Patch by Uwe Koecher: Avoid warnings in header files if -Wunused-parameters is given, for cases where parameters are only evaluated in Assert contexts and are thus unused in optimized mode. git-svn-id: https://svn.dealii.org/trunk@25658 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/base/geometry_info.h | 2 ++ deal.II/include/deal.II/base/work_stream.h | 2 ++ deal.II/include/deal.II/fe/fe_values.h | 1 + deal.II/include/deal.II/grid/tria_accessor.h | 1 + deal.II/include/deal.II/lac/full_matrix.h | 1 + deal.II/include/deal.II/lac/trilinos_sparse_matrix.h | 7 +++++++ deal.II/include/deal.II/lac/trilinos_vector_base.h | 1 + 7 files changed, 15 insertions(+) diff --git a/deal.II/include/deal.II/base/geometry_info.h b/deal.II/include/deal.II/base/geometry_info.h index 05e7db996d..f33bac3968 100644 --- a/deal.II/include/deal.II/base/geometry_info.h +++ b/deal.II/include/deal.II/base/geometry_info.h @@ -2607,6 +2607,7 @@ GeometryInfo<1>::cell_to_child_coordinates (const Point<1> &p, ExcIndexRange (child_index, 0, 2)); Assert (refine_case==RefinementCase<1>::cut_x, ExcInternalError()); + (void)refine_case; // removes -Wunused-parameter warning in optimized mode return p*2.0-unit_cell_vertex(child_index); } @@ -2751,6 +2752,7 @@ GeometryInfo<1>::child_to_cell_coordinates (const Point<1> &p, ExcIndexRange (child_index, 0, 2)); Assert (refine_case==RefinementCase<1>::cut_x, ExcInternalError()); + (void)refine_case; // removes -Wunused-parameter warning in optimized mode return (p+unit_cell_vertex(child_index))*0.5; } diff --git a/deal.II/include/deal.II/base/work_stream.h b/deal.II/include/deal.II/base/work_stream.h index 1b39b5c8e7..dd6fd8a93c 100644 --- a/deal.II/include/deal.II/base/work_stream.h +++ b/deal.II/include/deal.II/base/work_stream.h @@ -515,8 +515,10 @@ namespace WorkStream Assert (queue_length > 0, ExcMessage ("The queue length must be at least one, and preferably " "larger than the number of processors on this system.")); + (void)queue_length; // removes -Wunused-parameter warning in optimized mode Assert (chunk_size > 0, ExcMessage ("The chunk_size must be at least one.")); + (void)chunk_size; // removes -Wunused-parameter warning in optimized mode // if no work then skip. (only use // operator!= for iterators since we may diff --git a/deal.II/include/deal.II/fe/fe_values.h b/deal.II/include/deal.II/fe/fe_values.h index c4ba055eac..fcdf99f5e9 100644 --- a/deal.II/include/deal.II/fe/fe_values.h +++ b/deal.II/include/deal.II/fe/fe_values.h @@ -4325,6 +4325,7 @@ namespace FEValuesViews const Tensor<1,1> &t) { Assert (n < 1, ExcIndexRange (n, 0, 1)); + (void)n; // removes -Wunused-parameter warning in optimized mode const double array[1] = { t[0] }; return dealii::SymmetricTensor<2,1>(array); diff --git a/deal.II/include/deal.II/grid/tria_accessor.h b/deal.II/include/deal.II/grid/tria_accessor.h index 0c63c94c69..25f0a3e24d 100644 --- a/deal.II/include/deal.II/grid/tria_accessor.h +++ b/deal.II/include/deal.II/grid/tria_accessor.h @@ -77,6 +77,7 @@ namespace internal type (const int level) { Assert (level == 0, ExcInternalError()); + (void)level; // removes -Wunused-parameter warning in optimized mode } /** diff --git a/deal.II/include/deal.II/lac/full_matrix.h b/deal.II/include/deal.II/lac/full_matrix.h index 51708e58f6..6e33ecc93a 100644 --- a/deal.II/include/deal.II/lac/full_matrix.h +++ b/deal.II/include/deal.II/lac/full_matrix.h @@ -1492,6 +1492,7 @@ FullMatrix & FullMatrix::operator = (const number d) { Assert (d==number(0), ExcScalarAssignmentOnlyForZeroValue()); + (void)d; // removes -Wunused-parameter warning in optimized mode if (this->n_elements() != 0) memset (&this->values[0], 0, this->n_elements()*sizeof(number)); diff --git a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h index ff64607164..ef463416db 100644 --- a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h @@ -2855,6 +2855,7 @@ namespace TrilinosWrappers row_partitioner(), false); Assert (ierr == 0, ExcTrilinosError(ierr)); + (void)ierr; // removes -Wunused-but-set-variable in optimized mode } last_action = Add; @@ -3195,6 +3196,7 @@ namespace TrilinosWrappers { const int ierr = matrix->Scale (a); Assert (ierr == 0, ExcTrilinosError(ierr)); + (void)ierr; // removes -Wunused-variable in optimized mode return *this; } @@ -3211,6 +3213,7 @@ namespace TrilinosWrappers const int ierr = matrix->Scale (factor); Assert (ierr == 0, ExcTrilinosError(ierr)); + (void)ierr; // removes -Wunused-variable in optimized mode return *this; } @@ -3233,6 +3236,7 @@ namespace TrilinosWrappers const int ierr = matrix->Multiply (false, src.trilinos_vector(), dst.trilinos_vector()); Assert (ierr == 0, ExcTrilinosError(ierr)); + (void)ierr; // removes -Wunused-variable in optimized mode } @@ -3254,6 +3258,7 @@ namespace TrilinosWrappers const int ierr = matrix->Multiply (false, tril_src, tril_dst); Assert (ierr == 0, ExcTrilinosError(ierr)); + (void)ierr; // removes -Wunused-variable in optimized mode } @@ -3274,6 +3279,7 @@ namespace TrilinosWrappers const int ierr = matrix->Multiply (true, src.trilinos_vector(), dst.trilinos_vector()); Assert (ierr == 0, ExcTrilinosError(ierr)); + (void)ierr; // removes -Wunused-variable in optimized mode } @@ -3295,6 +3301,7 @@ namespace TrilinosWrappers const int ierr = matrix->Multiply (true, tril_src, tril_dst); Assert (ierr == 0, ExcTrilinosError(ierr)); + (void)ierr; // removes -Wunused-variable in optimized mode } diff --git a/deal.II/include/deal.II/lac/trilinos_vector_base.h b/deal.II/include/deal.II/lac/trilinos_vector_base.h index dc77b335fe..c3d422bcfc 100644 --- a/deal.II/include/deal.II/lac/trilinos_vector_base.h +++ b/deal.II/include/deal.II/lac/trilinos_vector_base.h @@ -1753,6 +1753,7 @@ namespace TrilinosWrappers const int jerr = vector->Update(c, *(x.vector), 1.); Assert (jerr == 0, ExcTrilinosError(jerr)); + (void)jerr; // removes -Wunused-parameter warning in optimized mode } -- 2.39.5