From: Daniel Arndt Date: Wed, 6 Jun 2018 07:59:16 +0000 (+0200) Subject: Fix Exceptions X-Git-Tag: v9.1.0-rc1~1062^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8781ab4835e2c7fcd231d3410a1903aca91e8e6f;p=dealii.git Fix Exceptions --- diff --git a/include/deal.II/algorithms/any_data.h b/include/deal.II/algorithms/any_data.h index 2c32cb6892..5f0fac0f2f 100644 --- a/include/deal.II/algorithms/any_data.h +++ b/include/deal.II/algorithms/any_data.h @@ -197,8 +197,8 @@ public: /// The requested type and the stored type are different DeclException2(ExcTypeMismatch, - char *, - char *, + std::string, + std::string, << "The requested type " << arg1 << " and the stored type " << arg2 << " must coincide."); diff --git a/include/deal.II/base/exceptions.h b/include/deal.II/base/exceptions.h index 5c5badfec7..65f63e7f7d 100644 --- a/include/deal.II/base/exceptions.h +++ b/include/deal.II/base/exceptions.h @@ -224,8 +224,8 @@ private: class Exception1 : public dealii::ExceptionBase \ { \ public: \ - Exception1(const type1 a1) : arg1(a1) \ - {} /*NOLINT*/ \ + Exception1(type1 const &a1) : arg1(a1) \ + {} \ virtual ~Exception1() noexcept \ {} \ virtual void \ @@ -235,7 +235,7 @@ private: } \ \ private: \ - const type1 arg1; \ + type1 const arg1; \ } @@ -245,26 +245,23 @@ private: * * @ingroup Exceptions */ -# define DeclException2(Exception2, type1, type2, outsequence) \ - class Exception2 : public dealii::ExceptionBase \ - { \ - public: \ - Exception2(const type1 a1, const type2 a2) : \ - /*NOLINT*/ \ - arg1(a1), \ - arg2(a2) \ - {} \ - virtual ~Exception2() noexcept \ - {} \ - virtual void \ - print_info(std::ostream &out) const override \ - { \ - out << " " outsequence << std::endl; \ - } \ - \ - private: \ - const type1 arg1; \ - const type2 arg2; \ +# define DeclException2(Exception2, type1, type2, outsequence) \ + class Exception2 : public dealii::ExceptionBase \ + { \ + public: \ + Exception2(type1 const &a1, type2 const &a2) : arg1(a1), arg2(a2) \ + {} \ + virtual ~Exception2() noexcept \ + {} \ + virtual void \ + print_info(std::ostream &out) const override \ + { \ + out << " " outsequence << std::endl; \ + } \ + \ + private: \ + type1 const arg1; \ + type2 const arg2; \ } @@ -278,8 +275,7 @@ private: class Exception3 : public dealii::ExceptionBase \ { \ public: \ - Exception3(const type1 a1, const type2 a2, const type3 a3) : \ - /*NOLINT*/ \ + Exception3(type1 const &a1, type2 const &a2, type3 const &a3) : \ arg1(a1), \ arg2(a2), \ arg3(a3) \ @@ -293,9 +289,9 @@ private: } \ \ private: \ - const type1 arg1; \ - const type2 arg2; \ - const type3 arg3; \ + type1 const arg1; \ + type2 const arg2; \ + type3 const arg3; \ } @@ -309,11 +305,10 @@ private: class Exception4 : public dealii::ExceptionBase \ { \ public: \ - Exception4(const type1 a1, \ - const type2 a2, /*NOLINT*/ \ - const type3 a3, \ - const type4 a4) : \ - /*NOLINT*/ \ + Exception4(type1 const &a1, \ + type2 const &a2, \ + type3 const &a3, \ + type4 const &a4) : \ arg1(a1), \ arg2(a2), \ arg3(a3), \ @@ -328,10 +323,10 @@ private: } \ \ private: \ - const type1 arg1; \ - const type2 arg2; \ - const type3 arg3; \ - const type4 arg4; \ + type1 const arg1; \ + type2 const arg2; \ + type3 const arg3; \ + type4 const arg4; \ } @@ -346,12 +341,11 @@ private: class Exception5 : public dealii::ExceptionBase \ { \ public: \ - Exception5(const type1 a1, \ - const type2 a2, \ - const type3 a3, /*NOLINT*/ \ - const type4 a4, \ - const type5 a5) : \ - /*NOLINT*/ \ + Exception5(type1 const &a1, \ + type2 const &a2, \ + type3 const &a3, \ + type4 const &a4, \ + type5 const &a5) : \ arg1(a1), \ arg2(a2), \ arg3(a3), \ @@ -367,11 +361,11 @@ private: } \ \ private: \ - const type1 arg1; \ - const type2 arg2; \ - const type3 arg3; \ - const type4 arg4; \ - const type5 arg5; \ + type1 const arg1; \ + type2 const arg2; \ + type3 const arg3; \ + type4 const arg4; \ + type5 const arg5; \ } #else /*ifndef DOXYGEN*/ @@ -587,7 +581,7 @@ namespace StandardExceptions * file. */ DeclException1(ExcFileNotOpen, - char *, + std::string, << "Could not open file " << arg1 << "."); /** diff --git a/include/deal.II/base/function_parser.h b/include/deal.II/base/function_parser.h index b8f16fcab5..0fc9a890ab 100644 --- a/include/deal.II/base/function_parser.h +++ b/include/deal.II/base/function_parser.h @@ -312,7 +312,7 @@ public: */ DeclException2(ExcParseError, int, - char *, + std::string, << "Parsing Error at Column " << arg1 << ". The parser said: " << arg2); diff --git a/include/deal.II/base/patterns.h b/include/deal.II/base/patterns.h index 4f84342bae..1219cee97f 100644 --- a/include/deal.II/base/patterns.h +++ b/include/deal.II/base/patterns.h @@ -1398,9 +1398,9 @@ namespace Patterns */ DeclException2(ExcNoMatch, std::string, - Patterns::PatternBase &, + const Patterns::PatternBase *, << "The string " << arg1 << " does not match the pattern \"" - << arg2.description() << "\""); + << arg2->description() << "\""); //@} } // namespace Tools } // namespace Patterns @@ -1514,7 +1514,7 @@ namespace Patterns str << (value ? "true" : "false"); else str << value; - AssertThrow(p->match(str.str()), ExcNoMatch(str.str(), *p)); + AssertThrow(p->match(str.str()), ExcNoMatch(str.str(), p.get())); return str.str(); } @@ -1523,7 +1523,7 @@ namespace Patterns const std::unique_ptr &p = Convert::to_pattern()) { - AssertThrow(p->match(s), ExcNoMatch(s, *p)); + AssertThrow(p->match(s), ExcNoMatch(s, p.get())); T value; if (std::is_same::value) value = (s == "true"); @@ -1769,7 +1769,7 @@ namespace Patterns for (unsigned int i = 1; i < vec.size(); ++i) s += p->get_separator() + " " + vec[i]; - AssertThrow(pattern->match(s), ExcNoMatch(s, *p)); + AssertThrow(pattern->match(s), ExcNoMatch(s, p)); return s; } @@ -1778,7 +1778,7 @@ namespace Patterns const std::unique_ptr &pattern = Convert::to_pattern()) { - AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern)); + AssertThrow(pattern->match(s), ExcNoMatch(s, pattern.get())); auto p = dynamic_cast(pattern.get()); AssertThrow(p, @@ -1845,7 +1845,7 @@ namespace Patterns for (unsigned int i = 1; i < vec.size(); ++i) s += p->get_separator() + " " + vec[i]; - AssertThrow(p->match(s), ExcNoMatch(s, *p)); + AssertThrow(p->match(s), ExcNoMatch(s, p)); return s; } @@ -1854,7 +1854,7 @@ namespace Patterns const std::unique_ptr &pattern = Convert::to_pattern()) { - AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern)); + AssertThrow(pattern->match(s), ExcNoMatch(s, pattern.get())); auto p = dynamic_cast(pattern.get()); AssertThrow(p, @@ -1919,7 +1919,7 @@ namespace Patterns for (unsigned int i = 1; i < vec.size(); ++i) s += p->get_separator() + " " + vec[i]; - AssertThrow(p->match(s), ExcNoMatch(s, *p)); + AssertThrow(p->match(s), ExcNoMatch(s, p)); return s; } @@ -1928,7 +1928,7 @@ namespace Patterns const std::unique_ptr &pattern = Convert::to_pattern()) { - AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern)); + AssertThrow(pattern->match(s), ExcNoMatch(s, pattern.get())); auto p = dynamic_cast(pattern.get()); AssertThrow(p, @@ -2012,7 +2012,7 @@ namespace Patterns p->get_separator() + " " + Convert::to_string(t.imag(), base_p); - AssertThrow(pattern->match(s), ExcNoMatch(s, *p)); + AssertThrow(pattern->match(s), ExcNoMatch(s, p)); return s; } @@ -2024,7 +2024,7 @@ namespace Patterns const std::unique_ptr &pattern = Convert::to_pattern()) { - AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern)); + AssertThrow(pattern->match(s), ExcNoMatch(s, pattern.get())); auto p = dynamic_cast(pattern.get()); AssertThrow(p, @@ -2058,7 +2058,7 @@ namespace Patterns const std::unique_ptr &pattern = Convert::to_pattern()) { - AssertThrow(pattern->match(t), ExcNoMatch(t, *pattern)); + AssertThrow(pattern->match(t), ExcNoMatch(t, pattern.get())); return t; } @@ -2067,7 +2067,7 @@ namespace Patterns const std::unique_ptr &pattern = Convert::to_pattern()) { - AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern)); + AssertThrow(pattern->match(s), ExcNoMatch(s, pattern.get())); return s; } }; @@ -2102,7 +2102,7 @@ namespace Patterns std::unordered_map m; m.insert(t); std::string s = Convert::to_string(m, pattern); - AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern)); + AssertThrow(pattern->match(s), ExcNoMatch(s, pattern.get())); return s; } @@ -2147,7 +2147,7 @@ namespace Patterns std::string str; for (unsigned int i = 0; i < string_array.size(); ++i) str += (i ? " " + p->get_separator() + " " : "") + string_array[i]; - AssertThrow(p->match(str), ExcNoMatch(str, *p)); + AssertThrow(p->match(str), ExcNoMatch(str, p)); return str; } @@ -2156,7 +2156,7 @@ namespace Patterns const std::unique_ptr &pattern = Convert::to_pattern()) { - AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern)); + AssertThrow(pattern->match(s), ExcNoMatch(s, pattern.get())); auto p = dynamic_cast(pattern.get()); AssertThrow(p, diff --git a/include/deal.II/fe/fe_values.h b/include/deal.II/fe/fe_values.h index 302b3b4fc8..9f90fd0b53 100644 --- a/include/deal.II/fe/fe_values.h +++ b/include/deal.II/fe/fe_values.h @@ -3187,7 +3187,7 @@ public: */ DeclException1( ExcAccessToUninitializedField, - char *, + std::string, << "You are requesting information from an FEValues/FEFaceValues/FESubfaceValues " << "object for which this kind of information has not been computed. What " << "information these objects compute is determined by the update_* flags you " diff --git a/include/deal.II/lac/lapack_support.h b/include/deal.II/lac/lapack_support.h index a2af518adc..bbfe7c96fd 100644 --- a/include/deal.II/lac/lapack_support.h +++ b/include/deal.II/lac/lapack_support.h @@ -186,7 +186,7 @@ namespace LAPACKSupport * A LAPACK function returned an error code. */ DeclException2(ExcErrorCode, - char *, + std::string, types::blas_int, << "The function " << arg1 << " returned with an error code " << arg2); @@ -217,7 +217,7 @@ namespace LAPACKSupport */ DeclException1( ExcMissing, - char *, + std::string, << "When you ran 'cmake' during installation of deal.II, " << "no suitable installation of the BLAS or LAPACK library could " << "be found. Consequently, the function <" << arg1 diff --git a/include/deal.II/lac/sparse_direct.h b/include/deal.II/lac/sparse_direct.h index e99241ad16..5650112878 100644 --- a/include/deal.II/lac/sparse_direct.h +++ b/include/deal.II/lac/sparse_direct.h @@ -275,7 +275,7 @@ public: */ DeclException2( ExcUMFPACKError, - char *, + std::string, int, << "UMFPACK routine " << arg1 << " returned error status " << arg2 << "." << "\n\n"