From 3648bfef390acfc998f81ee4d180ea83a55eba4e Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 27 Feb 2012 18:11:39 +0000 Subject: [PATCH] Use of deprecated functions generates compiler warnings --- include/cantera/base/ct_defs.h | 10 ++++++++++ include/cantera/equil/MultiPhase.h | 2 +- include/cantera/kinetics/Kinetics.h | 9 ++------- include/cantera/thermo/HMWSoln.h | 2 +- include/cantera/thermo/Phase.h | 2 +- include/cantera/thermo/SpeciesThermoMgr.h | 2 +- include/cantera/transport/TransportBase.h | 12 ++++-------- src/equil/MultiPhase.cpp | 2 +- 8 files changed, 21 insertions(+), 20 deletions(-) diff --git a/include/cantera/base/ct_defs.h b/include/cantera/base/ct_defs.h index b98fcf1f4..0a0765b12 100644 --- a/include/cantera/base/ct_defs.h +++ b/include/cantera/base/ct_defs.h @@ -26,6 +26,16 @@ #include #include +// Warn about deprecated functions at compile time +#ifdef __GNUC__ +#define DEPRECATED(func) func __attribute__ ((deprecated)) +#elif defined(_MSC_VER) +#define DEPRECATED(func) __declspec(deprecated) func +#else +#pragma message("WARNING: You need to implement DEPRECATED for this compiler") +#define DEPRECATED(func) func +#endif + /** * Namespace for the Cantera kernel. */ diff --git a/include/cantera/equil/MultiPhase.h b/include/cantera/equil/MultiPhase.h index f0a41266f..74dfb7c7f 100644 --- a/include/cantera/equil/MultiPhase.h +++ b/include/cantera/equil/MultiPhase.h @@ -551,7 +551,7 @@ public: * ThermoPhase objects. * switch to uploadMoleFractionsFromPhases(); */ - void updateMoleFractions(); + DEPRECATED(void updateMoleFractions()); //! Update the locally-stored composition within this object //! to match the current compositions of the phase objects. diff --git a/include/cantera/kinetics/Kinetics.h b/include/cantera/kinetics/Kinetics.h index 5297e80ac..d22dbf4da 100644 --- a/include/cantera/kinetics/Kinetics.h +++ b/include/cantera/kinetics/Kinetics.h @@ -144,10 +144,6 @@ public: /// Default constructor. Kinetics(); - /// This constructor initializes with a starting phase. - /// @deprecated - // Kinetics(thermo_t* thermo); - /// Destructor. virtual ~Kinetics(); @@ -302,7 +298,7 @@ public: * * @param n Index of the ThermoPhase being sought. */ - thermo_t& phase(size_t n=0) { + DEPRECATED(thermo_t& phase(size_t n=0)) { deprecatedMethod("Kinetics","phase","thermo"); return *m_thermo[n]; } @@ -314,7 +310,7 @@ public: * * @param n Index of the ThermoPhase being sought. */ - const thermo_t& phase(size_t n=0) const { + DEPRECATED(const thermo_t& phase(size_t n=0) const) { deprecatedMethod("Kinetics","phase","thermo"); return *m_thermo[n]; } @@ -1061,7 +1057,6 @@ protected: */ size_t m_surfphase; - //! Phase Index where reactions are assumed to be taking place /*! * We calculate this by assuming that the phase with the lowest dimensionality is the phase where reactions diff --git a/include/cantera/thermo/HMWSoln.h b/include/cantera/thermo/HMWSoln.h index e5158bd74..f2af6f2c9 100644 --- a/include/cantera/thermo/HMWSoln.h +++ b/include/cantera/thermo/HMWSoln.h @@ -2143,7 +2143,7 @@ public: * @deprecated * The getPartialMolarVolumes() expression is more precise. */ - double speciesMolarVolume(int k) const; + DEPRECATED(double speciesMolarVolume(int k) const); //! Value of the Debye Huckel constant as a function of temperature diff --git a/include/cantera/thermo/Phase.h b/include/cantera/thermo/Phase.h index 0308c5abd..f0e49c0b6 100644 --- a/include/cantera/thermo/Phase.h +++ b/include/cantera/thermo/Phase.h @@ -470,7 +470,7 @@ public: * * @deprecated */ - void getMolecularWeights(int iwt, doublereal* weights) const; + DEPRECATED(void getMolecularWeights(int iwt, doublereal* weights) const); /** * Copy the vector of molecular weights into array weights. diff --git a/include/cantera/thermo/SpeciesThermoMgr.h b/include/cantera/thermo/SpeciesThermoMgr.h index 632e0f1dd..7f2be75a6 100644 --- a/include/cantera/thermo/SpeciesThermoMgr.h +++ b/include/cantera/thermo/SpeciesThermoMgr.h @@ -371,7 +371,7 @@ class SpeciesThermo1 : public SpeciesThermo public: //! base constructor - SpeciesThermo1(); + DEPRECATED(SpeciesThermo1()); //! destructor virtual ~SpeciesThermo1(); diff --git a/include/cantera/transport/TransportBase.h b/include/cantera/transport/TransportBase.h index 6b5970542..c4937a1ec 100644 --- a/include/cantera/transport/TransportBase.h +++ b/include/cantera/transport/TransportBase.h @@ -249,23 +249,19 @@ public: //! Returns an integer index number. /*! - * This is for internal use + * @internal This is for internal use * of Cantera, and may be removed in the future. * * @return Returns the index number - * - * @deprecated */ - size_t index() const ; + size_t index() const; //! Set an integer index number. /*! - * This is for internal use of + * @internal This is for internal use of * Cantera, and may be removed in the future. * * @param i index value - * - * @deprecated */ void setIndex(size_t i); @@ -353,7 +349,7 @@ public: * * @deprecated This doesn't seem to be the essential input; it should just be the mobility. */ - virtual void mobilityRatio(double* mobRat) { + DEPRECATED(virtual void mobilityRatio(double* mobRat)) { err("mobilityRatio"); } diff --git a/src/equil/MultiPhase.cpp b/src/equil/MultiPhase.cpp index 46d62fc48..4ad995685 100644 --- a/src/equil/MultiPhase.cpp +++ b/src/equil/MultiPhase.cpp @@ -248,7 +248,7 @@ void MultiPhase::init() /// mole fractions stored in the phase objects m_init = true; - updateMoleFractions(); + uploadMoleFractionsFromPhases(); updatePhases(); }