diff --git a/include/cantera/base/global.h b/include/cantera/base/global.h index 3a1d5309f..555b3083f 100644 --- a/include/cantera/base/global.h +++ b/include/cantera/base/global.h @@ -180,6 +180,9 @@ void error(const std::string& msg); //! @copydoc Application::warn_deprecated void warn_deprecated(const std::string& method, const std::string& extra=""); +//! @copydoc Application::suppress_deprecation_warnings +void suppress_deprecation_warnings(); + //! @copydoc Application::Messages::setLogger void setLogger(Logger* logwriter); diff --git a/src/base/application.cpp b/src/base/application.cpp index 492dd6d85..dd6c6f6c6 100644 --- a/src/base/application.cpp +++ b/src/base/application.cpp @@ -321,6 +321,7 @@ Application::Application() : stop_on_error(false), options(), xmlfiles(), + m_suppress_deprecation_warnings(false), pMessenger() { #if !defined( THREAD_SAFE_CANTERA ) @@ -373,7 +374,7 @@ void Application::ApplicationDestroy() void Application::warn_deprecated(const std::string& method, const std::string& extra) { - if (warnings.count(method)) { + if (m_suppress_deprecation_warnings || warnings.count(method)) { return; } warnings.insert(method); diff --git a/src/base/application.h b/src/base/application.h index da9c1b7b0..64b6cd6ae 100644 --- a/src/base/application.h +++ b/src/base/application.h @@ -446,6 +446,10 @@ public: //! invocation of the application. void warn_deprecated(const std::string& method, const std::string& extra=""); + void suppress_deprecation_warnings() { + m_suppress_deprecation_warnings = true; + } + //! @copydoc Messages::setLogger void setLogger(Logger* logwriter) { pMessenger->setLogger(logwriter); @@ -549,6 +553,8 @@ protected: //! Vector of deprecation warnings that have been emitted (to suppress duplicates) std::set warnings; + bool m_suppress_deprecation_warnings; + //! Current pointer to the logwriter //Logger* logwriter; #ifdef WITH_HTML_LOGS diff --git a/src/base/global.cpp b/src/base/global.cpp index 7426e2103..1b35b7d2e 100644 --- a/src/base/global.cpp +++ b/src/base/global.cpp @@ -77,6 +77,11 @@ void warn_deprecated(const std::string& method, const std::string& extra) app()->warn_deprecated(method, extra); } +void suppress_deprecation_warnings() +{ + app()->suppress_deprecation_warnings(); +} + // **************** HTML Logging **************** #ifdef WITH_HTML_LOGS diff --git a/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp b/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp index d696b7988..300dda0ef 100644 --- a/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp +++ b/test_problems/ChemEquil_ionizedGas/ionizedGasEquil.cpp @@ -15,7 +15,7 @@ int main(int argc, char** argv) ChemEquil_print_lvl = 0; #endif try { - + suppress_deprecation_warnings(); IdealGasPhase* gas = new IdealGasMix("air_below6000K.xml","air_below6000K"); vector_fp IndVar2(6, 0.0); diff --git a/test_problems/VCSnonideal/LatticeSolid_LiSi/latsol.cpp b/test_problems/VCSnonideal/LatticeSolid_LiSi/latsol.cpp index 513665dff..fd4063977 100644 --- a/test_problems/VCSnonideal/LatticeSolid_LiSi/latsol.cpp +++ b/test_problems/VCSnonideal/LatticeSolid_LiSi/latsol.cpp @@ -11,6 +11,7 @@ using namespace Cantera; void testProblem() { + suppress_deprecation_warnings(); double T = 273.15 + 352.0; VCSnonideal::vcs_timing_print_lvl = 0; diff --git a/test_problems/VCSnonideal/NaCl_equil/nacl_equil.cpp b/test_problems/VCSnonideal/NaCl_equil/nacl_equil.cpp index c0303828c..0ac704af3 100644 --- a/test_problems/VCSnonideal/NaCl_equil/nacl_equil.cpp +++ b/test_problems/VCSnonideal/NaCl_equil/nacl_equil.cpp @@ -30,6 +30,7 @@ int main(int argc, char** argv) #ifdef _MSC_VER _set_output_format(_TWO_DIGIT_EXPONENT); #endif + suppress_deprecation_warnings(); // int solver = 2; int numSucc = 0; int numFail = 0;