From: Daniel Arndt Date: Fri, 22 Sep 2023 16:27:36 +0000 (-0400) Subject: Fix cases where we can't currently use a semicolon without additional braces X-Git-Tag: relicensing~469^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05356b1bc586435b004fae877b03e449df3ac3eb;p=dealii.git Fix cases where we can't currently use a semicolon without additional braces --- diff --git a/include/deal.II/lac/block_matrix_base.h b/include/deal.II/lac/block_matrix_base.h index 77e72087be..0d38ae90a4 100644 --- a/include/deal.II/lac/block_matrix_base.h +++ b/include/deal.II/lac/block_matrix_base.h @@ -1937,9 +1937,11 @@ BlockMatrixBase::add(const size_type row, size_type before = col_indices[0]; for (size_type i = 1; i < n_cols; ++i) if (col_indices[i] <= before) - Assert(false, - ExcMessage("Flag col_indices_are_sorted is set, but " - "indices appear to not be sorted.")); + { + Assert(false, + ExcMessage("Flag col_indices_are_sorted is set, but " + "indices appear to not be sorted.")); + } else before = col_indices[i]; # endif diff --git a/include/deal.II/lac/full_matrix.templates.h b/include/deal.II/lac/full_matrix.templates.h index f9544a31cd..515ed92362 100644 --- a/include/deal.II/lac/full_matrix.templates.h +++ b/include/deal.II/lac/full_matrix.templates.h @@ -1614,7 +1614,9 @@ FullMatrix::left_invert(const FullMatrix &A) A_t.Tadd(A, 1); A_t.mmult(A_t_times_A, A); if (number(A_t_times_A.determinant()) == number(0)) - Assert(false, ExcSingular()); + { + Assert(false, ExcSingular()); + } else { A_t_times_A_inv.invert(A_t_times_A); @@ -1653,7 +1655,9 @@ FullMatrix::right_invert(const FullMatrix &A) A_t.Tadd(A, 1); A.mmult(A_times_A_t, A_t); if (number(A_times_A_t.determinant()) == number(0)) - Assert(false, ExcSingular()); + { + Assert(false, ExcSingular()); + } else { A_times_A_t_inv.invert(A_times_A_t); diff --git a/tests/matrix_free/stokes_computation.cc b/tests/matrix_free/stokes_computation.cc index edca6c9a6e..d7a53ba9fe 100644 --- a/tests/matrix_free/stokes_computation.cc +++ b/tests/matrix_free/stokes_computation.cc @@ -240,15 +240,17 @@ namespace StokesClass { if (Utilities::MPI::this_mpi_process( src.block(0).get_mpi_communicator()) == 0) - AssertThrow( - false, - ExcMessage( - std::string( - "The iterative (bottom right) solver in BlockSchurPreconditioner::vmult " - "did not converge to a tolerance of " + - Utilities::to_string(solver_control.tolerance()) + - ". It reported the following error:\n\n") + - exc.what())); + { + AssertThrow( + false, + ExcMessage( + std::string( + "The iterative (bottom right) solver in BlockSchurPreconditioner::vmult " + "did not converge to a tolerance of " + + Utilities::to_string(solver_control.tolerance()) + + ". It reported the following error:\n\n") + + exc.what())); + } else throw QuietException(); } diff --git a/tests/mpi/trilinos_sparse_matrix_03.cc b/tests/mpi/trilinos_sparse_matrix_03.cc index 6d59272d05..3fa26883c4 100644 --- a/tests/mpi/trilinos_sparse_matrix_03.cc +++ b/tests/mpi/trilinos_sparse_matrix_03.cc @@ -105,13 +105,19 @@ test() { AssertThrow(p->row() == 0, ExcInternalError()); if (p->column() == 0) - AssertThrow(p->value() == 0.1, ExcInternalError()); + { + AssertThrow(p->value() == 0.1, ExcInternalError()); + } else if (p->column() == 2) - AssertThrow(p->value() == 0.2, ExcInternalError()); + { + AssertThrow(p->value() == 0.2, ExcInternalError()); + } else - // well, we didn't write here, so the only thing that - // should be in there is a zero - AssertThrow(p->value() == 0.0, ExcInternalError()); + { + // well, we didn't write here, so the only thing that + // should be in there is a zero + AssertThrow(p->value() == 0.0, ExcInternalError()); + } } } else @@ -122,11 +128,15 @@ test() { AssertThrow(p->row() == 2, ExcInternalError()); if (p->column() == 3) - AssertThrow(p->value() == 0.3, ExcInternalError()); + { + AssertThrow(p->value() == 0.3, ExcInternalError()); + } else - // well, we didn't write here, so the only thing that - // should be in there is a zero - AssertThrow(p->value() == 0.0, ExcInternalError()); + { + // well, we didn't write here, so the only thing that + // should be in there is a zero + AssertThrow(p->value() == 0.0, ExcInternalError()); + } } } @@ -143,13 +153,19 @@ test() { AssertThrow(p->row() == 0, ExcInternalError()); if (p->column() == 0) - AssertThrow(p->value() == 0.1, ExcInternalError()); + { + AssertThrow(p->value() == 0.1, ExcInternalError()); + } else if (p->column() == 2) - AssertThrow(p->value() == 0.2, ExcInternalError()); + { + AssertThrow(p->value() == 0.2, ExcInternalError()); + } else - // well, we didn't write here, so the only thing that - // should be in there is a zero - AssertThrow(p->value() == 0.0, ExcInternalError()); + { + // well, we didn't write here, so the only thing that + // should be in there is a zero + AssertThrow(p->value() == 0.0, ExcInternalError()); + } } } else @@ -161,11 +177,15 @@ test() { AssertThrow(p->row() == 2, ExcInternalError()); if (p->column() == 3) - AssertThrow(p->value() == 0.3, ExcInternalError()); + { + AssertThrow(p->value() == 0.3, ExcInternalError()); + } else - // well, we didn't write here, so the only thing that - // should be in there is a zero - AssertThrow(p->value() == 0.0, ExcInternalError()); + { + // well, we didn't write here, so the only thing that + // should be in there is a zero + AssertThrow(p->value() == 0.0, ExcInternalError()); + } } } @@ -179,13 +199,19 @@ test() { AssertThrow(p->row() == 0, ExcInternalError()); if (p->column() == 0) - AssertThrow(p->value() == 108, ExcInternalError()); + { + AssertThrow(p->value() == 108, ExcInternalError()); + } else if (p->column() == 2) - AssertThrow(p->value() == 0.2, ExcInternalError()); + { + AssertThrow(p->value() == 0.2, ExcInternalError()); + } else - // well, we didn't write here, so the only thing that - // should be in there is a zero - AssertThrow(p->value() == 0.0, ExcInternalError()); + { + // well, we didn't write here, so the only thing that + // should be in there is a zero + AssertThrow(p->value() == 0.0, ExcInternalError()); + } } } else @@ -196,11 +222,15 @@ test() { AssertThrow(p->row() == 2, ExcInternalError()); if (p->column() == 3) - AssertThrow(p->value() == 42, ExcInternalError()); + { + AssertThrow(p->value() == 42, ExcInternalError()); + } else - // well, we didn't write here, so the only thing that - // should be in there is a zero - AssertThrow(p->value() == 0.0, ExcInternalError()); + { + // well, we didn't write here, so the only thing that + // should be in there is a zero + AssertThrow(p->value() == 0.0, ExcInternalError()); + } } } diff --git a/tests/multigrid-global-coarsening/stokes_computation.cc b/tests/multigrid-global-coarsening/stokes_computation.cc index 2edf3d4a8e..5a2ce6abdd 100644 --- a/tests/multigrid-global-coarsening/stokes_computation.cc +++ b/tests/multigrid-global-coarsening/stokes_computation.cc @@ -240,15 +240,17 @@ namespace StokesClass { if (Utilities::MPI::this_mpi_process( src.block(0).get_mpi_communicator()) == 0) - AssertThrow( - false, - ExcMessage( - std::string( - "The iterative (bottom right) solver in BlockSchurPreconditioner::vmult " - "did not converge to a tolerance of " + - Utilities::to_string(solver_control.tolerance()) + - ". It reported the following error:\n\n") + - exc.what())); + { + AssertThrow( + false, + ExcMessage( + std::string( + "The iterative (bottom right) solver in BlockSchurPreconditioner::vmult " + "did not converge to a tolerance of " + + Utilities::to_string(solver_control.tolerance()) + + ". It reported the following error:\n\n") + + exc.what())); + } else throw QuietException(); } diff --git a/tests/numerics/no_flux_18.cc b/tests/numerics/no_flux_18.cc index e4c972c1a7..9784b7a8fb 100644 --- a/tests/numerics/no_flux_18.cc +++ b/tests/numerics/no_flux_18.cc @@ -241,15 +241,17 @@ namespace StokesClass { if (Utilities::MPI::this_mpi_process( src.block(0).get_mpi_communicator()) == 0) - AssertThrow( - false, - ExcMessage( - std::string( - "The iterative (bottom right) solver in BlockSchurPreconditioner::vmult " - "did not converge to a tolerance of " + - Utilities::to_string(solver_control.tolerance()) + - ". It reported the following error:\n\n") + - exc.what())); + { + AssertThrow( + false, + ExcMessage( + std::string( + "The iterative (bottom right) solver in BlockSchurPreconditioner::vmult " + "did not converge to a tolerance of " + + Utilities::to_string(solver_control.tolerance()) + + ". It reported the following error:\n\n") + + exc.what())); + } else throw QuietException(); }