From: Wolfgang Bangerth Date: Tue, 13 Jun 2000 14:10:40 +0000 (+0000) Subject: Allow this file to be compiled with -pedantic. this required some X-Git-Tag: v8.0.0~20403 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09fbd5165806763b2ab59eb1bb2eb770b5bd60dd;p=dealii.git Allow this file to be compiled with -pedantic. this required some work-arounds, described in the comments added in this patch. git-svn-id: https://svn.dealii.org/trunk@3009 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/precondition_block.templates.h b/deal.II/lac/include/lac/precondition_block.templates.h index 791f737f5c..ccf1790635 100644 --- a/deal.II/lac/include/lac/precondition_block.templates.h +++ b/deal.II/lac/include/lac/precondition_block.templates.h @@ -133,14 +133,36 @@ void PreconditionBlockJacobi ::operator() (Vector &dst, const Vector &src) const { - Assert(A!=0, ExcNoMatrixGivenToUse()); + // introduce the following typedef + // since in the use of exceptions, + // strict C++ requires us to + // specify them fully as they are + // from a template dependent base + // class. thus, we'd have to write + // PreconditionBlock::ExcNoMatrixGivenToUse, + // which is lengthy, but also poses + // some problems to the + // preprocessor due to the comma in + // the template arg list. we could + // then wrap the whole thing into + // parentheses, but that creates a + // parse error for gcc for the + // exceptions that do not take + // args... + typedef PreconditionBlock BaseClass; + Assert(A!=0, typename BaseClass::ExcNoMatrixGivenToUse()); + const SparseMatrix &M=*A; - Assert (M.m() == M.n(), ExcMatrixNotSquare()); - Assert (blocksize!=0, ExcBlockSizeNotSet()); - Assert (M.m()%blocksize==0, ExcWrongBlockSize(blocksize, M.m())); const unsigned int n_cells=M.m()/blocksize; + + Assert (M.m() == M.n(), + typename BaseClass::ExcMatrixNotSquare()); + Assert (blocksize!=0, + typename BaseClass::ExcBlockSizeNotSet()); + Assert (M.m()%blocksize==0, + typename BaseClass::ExcWrongBlockSize(blocksize, M.m())); Assert (inverse.size()==0 || inverse.size()==n_cells, - ExcWrongNumberOfInverses(inverse.size(), n_cells)); + typename BaseClass::ExcWrongNumberOfInverses(inverse.size(), n_cells)); Vector b_cell(blocksize), x_cell(blocksize); @@ -216,14 +238,37 @@ template void PreconditionBlockSOR::operator() (Vector &dst, const Vector &src) const { - Assert(A!=0, ExcNoMatrixGivenToUse()); + // introduce the following typedef + // since in the use of exceptions, + // strict C++ requires us to + // specify them fully as they are + // from a template dependent base + // class. thus, we'd have to write + // PreconditionBlock::ExcNoMatrixGivenToUse, + // which is lengthy, but also poses + // some problems to the + // preprocessor due to the comma in + // the template arg list. we could + // then wrap the whole thing into + // parentheses, but that creates a + // parse error for gcc for the + // exceptions that do not take + // args... + typedef PreconditionBlock BaseClass; + + Assert (A!=0, typename BaseClass::ExcNoMatrixGivenToUse()); + const SparseMatrix &M=*A; - Assert (M.m() == M.n(), ExcMatrixNotSquare()); - Assert (blocksize!=0, ExcBlockSizeNotSet()); - Assert (M.m()%blocksize==0, ExcWrongBlockSize(blocksize, M.m())); const unsigned int n_cells=M.m()/blocksize; + + Assert (M.m() == M.n(), + typename BaseClass::ExcMatrixNotSquare()); + Assert (blocksize!=0, + typename BaseClass::ExcBlockSizeNotSet()); + Assert (M.m()%blocksize==0, + typename BaseClass::ExcWrongBlockSize(blocksize, M.m())); Assert (inverse.size()==0 || inverse.size()==n_cells, - ExcWrongNumberOfInverses(inverse.size(), n_cells)); + typename BaseClass::ExcWrongNumberOfInverses(inverse.size(), n_cells)); const SparsityPattern &spars = M.get_sparsity_pattern(); const unsigned int *rowstart = spars.get_rowstart_indices();