From 2c78d2d59017ae4888a0b8acddec41224f1d95a9 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 20 Apr 2020 18:01:19 +0000 Subject: [PATCH] Fight warnings --- CMakeLists.txt | 39 ++++++++++++++++++++++++ src/CCC/BatchManager_CCC.cxx | 2 +- src/COORM/BatchManager_COORM.cxx | 3 ++ src/Core/BatchManager.cxx | 18 +++++------ src/Core/BatchManagerCatalog.hxx | 4 +-- src/Core/CommunicationProtocolSH.cxx | 12 ++++---- src/Core/Constants.hxx | 1 + src/Core/Log.hxx | 4 +-- src/Core/MpiImpl.cxx | 20 ++++++------- src/Core/ParameterTypeMap.hxx | 4 +-- src/Core/Test/SimpleParser.cxx | 26 ++++++++-------- src/Core/Test/SimpleParser.hxx | 26 ++++++++-------- src/Core/Test/Test_SimpleParser.cxx | 4 +-- src/Core/Versatile.cxx | 45 ++++++++++++++-------------- src/Core/Versatile.hxx | 42 +++++++++++++------------- src/LSF/BatchManager_LSF.cxx | 2 +- src/Local/BatchManager_Local.cxx | 2 +- src/OAR/BatchManager_OAR.cxx | 1 + src/PBS/BatchManager_PBS.cxx | 2 +- src/SGE/BatchManager_SGE.cxx | 2 +- src/Vishnu/BatchManager_Vishnu.cxx | 2 +- 21 files changed, 153 insertions(+), 108 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c89c354..a120733 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,45 @@ IF(LIBBATCH_LOCAL_SUBMISSION) LIBBATCH_FIND_ALL_LOCAL_COMMANDS() ENDIF() +INCLUDE(CheckCXXCompilerFlag) + +SET(LIBBATCH_NO_CXX11_SUPPORT FALSE CACHE BOOL "Switch OFF C++-11 standard") +IF(NOT LIBBATCH_NO_CXX11_SUPPORT) + # C++11 support + CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) + IF(COMPILER_SUPPORTS_CXX11) + MESSAGE(STATUS "Enable C++11 support") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + ELSE() + CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) + IF(COMPILER_SUPPORTS_CXX0X) + MESSAGE(STATUS "Enable C++0x support") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + ELSE() + MESSAGE(WARNING "Compiler ${CMAKE_CXX_COMPILER} has no C++11 support.") + ENDIF() + ENDIF() +ENDIF() + +IF(NOT (WIN32 OR APPLE)) + SET(LIBBATCH_DEBUG_WARNINGS FALSE CACHE BOOL "Print more compiler warnings") + SET(LIBBATCH_TREAT_WARNINGS_AS_ERRORS FALSE CACHE BOOL "Treat compiler warnings as errors") + IF(LIBBATCH_DEBUG_WARNINGS) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic") + ENDIF() + IF(LIBBATCH_TREAT_WARNINGS_AS_ERRORS) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") + ENDIF() +ENDIF() + +# Compiler flag to disable treating alternative C++ tokens (compatibility with MSVS) +CHECK_CXX_COMPILER_FLAG("-fno-operator-names" COMPILER_SUPPORTS_NO_OPERATOR_NAMES) +IF(COMPILER_SUPPORTS_NO_OPERATOR_NAMES) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-operator-names") +ENDIF() + # Prerequisites detection: # ======================== FIND_PACKAGE(LibbatchPThread REQUIRED) diff --git a/src/CCC/BatchManager_CCC.cxx b/src/CCC/BatchManager_CCC.cxx index c69d625..7843e40 100644 --- a/src/CCC/BatchManager_CCC.cxx +++ b/src/CCC/BatchManager_CCC.cxx @@ -156,7 +156,7 @@ namespace Batch { // Methode pour le controle des jobs : teste si un job est present en machine - bool BatchManager_CCC::isRunning(const JobId & jobid) + bool BatchManager_CCC::isRunning(const JobId & /*jobid*/) { throw NotYetImplementedException("BatchManager_CCC::isRunning"); } diff --git a/src/COORM/BatchManager_COORM.cxx b/src/COORM/BatchManager_COORM.cxx index 5676073..9fbbabd 100644 --- a/src/COORM/BatchManager_COORM.cxx +++ b/src/COORM/BatchManager_COORM.cxx @@ -179,6 +179,9 @@ namespace Batch int edt = 0; int mem = 0; string queue = ""; + LIBBATCH_UNUSED(nbproc); + LIBBATCH_UNUSED(edt); + LIBBATCH_UNUSED(mem); // Mandatory parameters if (params.find(WORKDIR) != params.end()) diff --git a/src/Core/BatchManager.cxx b/src/Core/BatchManager.cxx index 10a1e98..3af9e2e 100644 --- a/src/Core/BatchManager.cxx +++ b/src/Core/BatchManager.cxx @@ -84,48 +84,48 @@ namespace Batch { } // Methode pour le controle des jobs : retire un job du gestionnaire - void BatchManager::deleteJob(const JobId & jobid) + void BatchManager::deleteJob(const JobId & /*jobid*/) { throw NotYetImplementedException("Method deleteJob not implemented by Batch Manager \"" + _type + "\""); } // Methode pour le controle des jobs : suspend un job en file d'attente - void BatchManager::holdJob(const JobId & jobid) + void BatchManager::holdJob(const JobId & /*jobid*/) { throw NotYetImplementedException("Method holdJob not implemented by Batch Manager \"" + _type + "\""); } // Methode pour le controle des jobs : relache un job suspendu - void BatchManager::releaseJob(const JobId & jobid) + void BatchManager::releaseJob(const JobId & /*jobid*/) { throw NotYetImplementedException("Method releaseJob not implemented by Batch Manager \"" + _type + "\""); } // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env) + void BatchManager::alterJob(const JobId & /*jobid*/, const Parametre & /*param*/, const Environnement & /*env*/) { throw NotYetImplementedException("Method alterJob not implemented by Batch Manager \"" + _type + "\""); } // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager::alterJob(const JobId & jobid, const Parametre & param) + void BatchManager::alterJob(const JobId & /*jobid*/, const Parametre & /*param*/) { throw NotYetImplementedException("Method alterJob not implemented by Batch Manager \"" + _type + "\""); } // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager::alterJob(const JobId & jobid, const Environnement & env) + void BatchManager::alterJob(const JobId & /*jobid*/, const Environnement & /*env*/) { throw NotYetImplementedException("Method alterJob not implemented by Batch Manager \"" + _type + "\""); } // Methode pour le controle des jobs : renvoie l'etat du job - JobInfo BatchManager::queryJob(const JobId & jobid) + JobInfo BatchManager::queryJob(const JobId & /*jobid*/) { throw NotYetImplementedException("Method queryJob not implemented by Batch Manager \"" + _type + "\""); } - const JobId BatchManager::addJob(const Job & job, const string & reference) + const JobId BatchManager::addJob(const Job & /*job*/, const string & reference) { return JobId(this, reference); } @@ -390,7 +390,7 @@ namespace Batch { } } - const Batch::JobId BatchManager::runJob(const Batch::Job & job) + const Batch::JobId BatchManager::runJob(const Batch::Job & /*job*/) { throw NotYetImplementedException("Method runJob not implemented by Batch Manager \"" + _type + "\""); } diff --git a/src/Core/BatchManagerCatalog.hxx b/src/Core/BatchManagerCatalog.hxx index 63b6b21..4e7803d 100644 --- a/src/Core/BatchManagerCatalog.hxx +++ b/src/Core/BatchManagerCatalog.hxx @@ -66,8 +66,8 @@ namespace Batch { private: // Forbid the use of copy constructor and assignment operator - BatchManagerCatalog(const BatchManagerCatalog & orig) {} - void operator=(const BatchManagerCatalog & orig) {} + BatchManagerCatalog(const BatchManagerCatalog &) {} + void operator=(const BatchManagerCatalog &) {} }; diff --git a/src/Core/CommunicationProtocolSH.cxx b/src/Core/CommunicationProtocolSH.cxx index 4f55ac5..2822b9d 100644 --- a/src/Core/CommunicationProtocolSH.cxx +++ b/src/Core/CommunicationProtocolSH.cxx @@ -41,8 +41,8 @@ namespace Batch { } vector CommunicationProtocolSH::getExecCommandArgs(const string & subCommand, - const string & host, - const string & user) const + const string & /*host*/, + const string & /*user*/) const { vector cmd; @@ -60,11 +60,11 @@ namespace Batch { } vector CommunicationProtocolSH::getCopyCommandArgs(const string & sourcePath, - const string & sourceHost, - const string & sourceUser, + const string & /*sourceHost*/, + const string & /*sourceUser*/, const string & destinationPath, - const string & destinationHost, - const string & destinationUser) const + const string & /*destinationHost*/, + const string & /*destinationUser*/) const { vector cmd; cmd.push_back(CP_COMMAND); diff --git a/src/Core/Constants.hxx b/src/Core/Constants.hxx index 591f248..b29fdc4 100644 --- a/src/Core/Constants.hxx +++ b/src/Core/Constants.hxx @@ -39,6 +39,7 @@ // TODO: replace those static declarations by an external description file (XML for instance) #define decl_extern_Constant(constant) extern BATCH_EXPORT const std::string constant #define def_Constant(constant) const std::string constant = #constant +#define LIBBATCH_UNUSED(var) (void)var namespace Batch { diff --git a/src/Core/Log.hxx b/src/Core/Log.hxx index 21b89eb..47245dc 100644 --- a/src/Core/Log.hxx +++ b/src/Core/Log.hxx @@ -53,8 +53,8 @@ namespace Batch { static Log & getInstance(); // Forbid the use of copy constructor and assignment operator - Log(const Log & orig) {} - void operator=(const Log & orig) {} + Log(const Log &) {} + void operator=(const Log &) {} std::ofstream _stream; diff --git a/src/Core/MpiImpl.cxx b/src/Core/MpiImpl.cxx index 13650c4..9cb46d4 100644 --- a/src/Core/MpiImpl.cxx +++ b/src/Core/MpiImpl.cxx @@ -58,14 +58,14 @@ string MpiImpl_LAM::rank() return "${LAMRANK}"; } -string MpiImpl_LAM::boot(const string machinefile, const unsigned int nbnodes) +string MpiImpl_LAM::boot(const string machinefile, const unsigned int /*nbnodes*/) { ostringstream oss; oss << "lamboot " << machinefile << endl; return oss.str(); } -string MpiImpl_LAM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) +string MpiImpl_LAM::run(const string /*machinefile*/, const unsigned int nbproc, const string fileNameToExecute) { ostringstream oss; oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl; @@ -105,7 +105,7 @@ string MpiImpl_MPICH1::rank() return "${MPIRUN_RANK}"; } -string MpiImpl_MPICH1::boot(const string machinefile, const unsigned int nbnodes) +string MpiImpl_MPICH1::boot(const string /*machinefile*/, const unsigned int /*nbnodes*/) { return ""; } @@ -158,7 +158,7 @@ string MpiImpl_MPICH2::boot(const string machinefile, const unsigned int nbnodes return oss.str(); } -string MpiImpl_MPICH2::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) +string MpiImpl_MPICH2::run(const string /*machinefile*/, const unsigned int nbproc, const string fileNameToExecute) { ostringstream oss; oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl; @@ -198,7 +198,7 @@ string MpiImpl_OPENMPI::rank() return "${OMPI_MCA_ns_nds_vpid}"; } -string MpiImpl_OPENMPI::boot(const string machinefile, const unsigned int nbnodes) +string MpiImpl_OPENMPI::boot(const string /*machinefile*/, const unsigned int /*nbnodes*/) { return ""; } @@ -241,7 +241,7 @@ string MpiImpl_OMPI::rank() return "${OMPI_MCA_ns_nds_vpid}"; } -string MpiImpl_OMPI::boot(const string machinefile, const unsigned int nbnodes) +string MpiImpl_OMPI::boot(const string /*machinefile*/, const unsigned int /*nbnodes*/) { return ""; } @@ -284,12 +284,12 @@ string MpiImpl_SLURM::rank() return "${SLURM_PROCID}"; } -string MpiImpl_SLURM::boot(const string machinefile, const unsigned int nbnodes) +string MpiImpl_SLURM::boot(const string /*machinefile*/, const unsigned int /*nbnodes*/) { return ""; } -string MpiImpl_SLURM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) +string MpiImpl_SLURM::run(const string /*machinefile*/, const unsigned int /*nbproc*/, const string fileNameToExecute) { ostringstream oss; oss << "srun " << fileNameToExecute << endl; @@ -327,12 +327,12 @@ string MpiImpl_PRUN::rank() return "${RMS_RANK}"; } -string MpiImpl_PRUN::boot(const string machinefile, const unsigned int nbnodes) +string MpiImpl_PRUN::boot(const string /*machinefile*/, const unsigned int /*nbnodes*/) { return ""; } -string MpiImpl_PRUN::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) +string MpiImpl_PRUN::run(const string /*machinefile*/, const unsigned int nbproc, const string fileNameToExecute) { ostringstream oss; oss << "prun -n " << nbproc << " " << "-p mpi " << fileNameToExecute << endl; diff --git a/src/Core/ParameterTypeMap.hxx b/src/Core/ParameterTypeMap.hxx index 29d1ac7..d2ccf72 100644 --- a/src/Core/ParameterTypeMap.hxx +++ b/src/Core/ParameterTypeMap.hxx @@ -67,8 +67,8 @@ namespace Batch { private: // Forbid the use of copy constructor and assignment operator - ParameterTypeMap(const ParameterTypeMap & orig) {} - void operator=(const ParameterTypeMap & orig) {} + ParameterTypeMap(const ParameterTypeMap &) {} + void operator=(const ParameterTypeMap &) {} }; diff --git a/src/Core/Test/SimpleParser.cxx b/src/Core/Test/SimpleParser.cxx index 28360fd..343469d 100644 --- a/src/Core/Test/SimpleParser.cxx +++ b/src/Core/Test/SimpleParser.cxx @@ -38,31 +38,31 @@ using namespace std; -ParserException::ParserException(string msg) throw() +ParserException::ParserException(string msg) noexcept : exception(), _msg(msg) { } -ParserException::~ParserException() throw() +ParserException::~ParserException() noexcept { } -const char * ParserException::what() const throw() +const char * ParserException::what() const noexcept { return _msg.c_str(); } -SimpleParser::SimpleParser() throw() +SimpleParser::SimpleParser() noexcept { } -SimpleParser::~SimpleParser() throw() +SimpleParser::~SimpleParser() noexcept { } -std::string SimpleParser::trim(const std::string & str) const throw() +std::string SimpleParser::trim(const std::string & str) const noexcept { size_t beg = str.find_first_not_of(" \t"); if (beg == string::npos) beg = 0; @@ -70,7 +70,7 @@ std::string SimpleParser::trim(const std::string & str) const throw() return str.substr(beg, end-beg+1); } -void SimpleParser::parse(const string & filename) throw(ParserException) +void SimpleParser::parse(const string & filename) { ifstream fileStream(filename.c_str()); if (!fileStream) { @@ -109,7 +109,7 @@ void SimpleParser::parse(const string & filename) throw(ParserException) fileStream.close(); } -void SimpleParser::parseTestConfigFile() throw(ParserException) +void SimpleParser::parseTestConfigFile() { char * filename = getenv(TEST_CONFIG_FILE_ENV_VAR); if (filename == NULL) { @@ -119,7 +119,7 @@ void SimpleParser::parseTestConfigFile() throw(ParserException) } } -const string & SimpleParser::getValue(const string & key) const throw(ParserException) +const string & SimpleParser::getValue(const string & key) const { map::const_iterator iter = _configmap.find(key); if (iter == _configmap.end()) { @@ -129,7 +129,7 @@ const string & SimpleParser::getValue(const string & key) const throw(ParserExce } const string & SimpleParser::getTestValue(const string & bmType, const string & protocolStr, - const string & key) const throw(ParserException) + const string & key) const { string fullkey = string("TEST_") + bmType + "_" + protocolStr + "_" + key; try { @@ -143,7 +143,7 @@ const string & SimpleParser::getTestValue(const string & bmType, const string & return getValue(fullkey); } -int SimpleParser::getValueAsInt(const string & key) const throw(ParserException) +int SimpleParser::getValueAsInt(const string & key) const { const string & valueStr = getValue(key); const char * valueCStr = valueStr.c_str(); @@ -156,7 +156,7 @@ int SimpleParser::getValueAsInt(const string & key) const throw(ParserException) } int SimpleParser::getTestValueAsInt(const string & bmType, const string & protocolStr, - const string & key) const throw(ParserException) + const string & key) const { string fullkey = string("TEST_") + bmType + "_" + protocolStr + "_" + key; try { @@ -170,7 +170,7 @@ int SimpleParser::getTestValueAsInt(const string & bmType, const string & protoc return getValueAsInt(fullkey); } -ostream & operator <<(ostream & os, const SimpleParser & parser) throw() +ostream & operator <<(ostream & os, const SimpleParser & parser) noexcept { if (parser._configmap.empty()) { os << "Empty map" << endl; diff --git a/src/Core/Test/SimpleParser.hxx b/src/Core/Test/SimpleParser.hxx index ec0f0b0..fb31424 100644 --- a/src/Core/Test/SimpleParser.hxx +++ b/src/Core/Test/SimpleParser.hxx @@ -36,10 +36,10 @@ class ParserException : public std::exception { public: - ParserException(std::string msg) throw(); - virtual ~ParserException() throw(); + ParserException(std::string msg) noexcept; + virtual ~ParserException() noexcept; - virtual const char *what() const throw(); + virtual const char *what() const noexcept; private: std::string _msg; @@ -48,22 +48,22 @@ private: class SimpleParser { public: - SimpleParser() throw(); - virtual ~SimpleParser() throw(); + SimpleParser() noexcept; + virtual ~SimpleParser() noexcept; - void parse(const std::string & filename) throw(ParserException); - void parseTestConfigFile() throw(ParserException); - const std::string & getValue(const std::string & key) const throw(ParserException); + void parse(const std::string & filename); + void parseTestConfigFile(); + const std::string & getValue(const std::string & key) const; const std::string & getTestValue(const std::string & bmType, const std::string & protocolStr, - const std::string & key) const throw(ParserException); - int getValueAsInt(const std::string & key) const throw(ParserException); + const std::string & key) const; + int getValueAsInt(const std::string & key) const; int getTestValueAsInt(const std::string & bmType, const std::string & protocolStr, - const std::string & key) const throw(ParserException); + const std::string & key) const; - friend std::ostream & operator <<(std::ostream & os, const SimpleParser & parser) throw(); + friend std::ostream & operator <<(std::ostream & os, const SimpleParser & parser) noexcept; private: - std::string trim(const std::string & str) const throw(); + std::string trim(const std::string & str) const noexcept; std::map _configmap; }; diff --git a/src/Core/Test/Test_SimpleParser.cxx b/src/Core/Test/Test_SimpleParser.cxx index f635e42..e10403a 100644 --- a/src/Core/Test/Test_SimpleParser.cxx +++ b/src/Core/Test/Test_SimpleParser.cxx @@ -35,7 +35,7 @@ using namespace std; -int main(int argc, char** argv) +int main(int /*argc*/, char** /*argv*/) { cout << "*******************************************************************************************" << endl; cout << "This program tests the simple parser that parses the configuration file used in the other" << endl; @@ -49,7 +49,7 @@ int main(int argc, char** argv) try { // Parse the configuration file parser.parseTestConfigFile(); - } catch (ParserException e) { + } catch (const ParserException& e) { cerr << "Parser error: " << e.what() << endl; return 1; } diff --git a/src/Core/Versatile.cxx b/src/Core/Versatile.cxx index 010849b..ff85ba2 100644 --- a/src/Core/Versatile.cxx +++ b/src/Core/Versatile.cxx @@ -52,9 +52,10 @@ namespace Batch { } Versatile::Versatile(const Versatile & V) - : _discriminator(V._discriminator), - _maxsize(V._maxsize), - _name(V._name) + : list(), + _discriminator(V._discriminator), + _maxsize(V._maxsize), + _name(V._name) { Versatile::const_iterator it; for(it=V.begin(); it!=V.end(); it++) @@ -66,7 +67,7 @@ namespace Batch { eraseAll(); } - Versatile & Versatile::operator = (const long l) throw(TypeMismatchException) + Versatile & Versatile::operator = (const long l) { checkType(LONG); eraseAll(); @@ -74,7 +75,7 @@ namespace Batch { return *this; } - Versatile & Versatile::operator = (const string & ch) throw(TypeMismatchException) + Versatile & Versatile::operator = (const string & ch) { checkType(STRING); eraseAll(); @@ -82,7 +83,7 @@ namespace Batch { return *this; } - Versatile & Versatile::operator +=(const string & ch) throw(TypeMismatchException,ListIsFullException) + Versatile & Versatile::operator +=(const string & ch) { checkType(STRING); @@ -97,28 +98,28 @@ namespace Batch { return *this; } - Versatile & Versatile::operator , (const string & ch) throw(TypeMismatchException,ListIsFullException) + Versatile & Versatile::operator , (const string & ch) { *this += ch; return *this; } - Versatile & Versatile::operator = (const char * ch) throw(TypeMismatchException) + Versatile & Versatile::operator = (const char * ch) { return operator=(string(ch)); } - Versatile & Versatile::operator +=(const char * ch) throw(TypeMismatchException,ListIsFullException) + Versatile & Versatile::operator +=(const char * ch) { return operator+=(string(ch)); } - Versatile & Versatile::operator , (const char * ch) throw(TypeMismatchException,ListIsFullException) + Versatile & Versatile::operator , (const char * ch) { return operator,(string(ch)); } - Versatile & Versatile::operator = (const Couple & cp) throw(TypeMismatchException) + Versatile & Versatile::operator = (const Couple & cp) { checkType(COUPLE); eraseAll(); @@ -126,7 +127,7 @@ namespace Batch { return *this; } - Versatile & Versatile::operator +=(const Couple & cp) throw(TypeMismatchException,ListIsFullException) + Versatile & Versatile::operator +=(const Couple & cp) { checkType(COUPLE); // If max size is reached, throw a ListIsFullException @@ -140,7 +141,7 @@ namespace Batch { return *this; } - Versatile & Versatile::operator , (const Couple & cp) throw(TypeMismatchException,ListIsFullException) + Versatile & Versatile::operator , (const Couple & cp) { *this += cp; return *this; @@ -158,7 +159,7 @@ namespace Batch { return os; } - Versatile & Versatile::operator = (const int i) throw(TypeMismatchException) + Versatile & Versatile::operator = (const int i) { checkType(LONG); eraseAll(); @@ -166,7 +167,7 @@ namespace Batch { return *this; } - Versatile & Versatile::operator = (const bool b) throw(TypeMismatchException) + Versatile & Versatile::operator = (const bool b) { checkType(BOOL); eraseAll(); @@ -174,13 +175,13 @@ namespace Batch { return *this; } - void Versatile::checkType(DiscriminatorType t) const throw(TypeMismatchException) + void Versatile::checkType(DiscriminatorType t) const { if (_discriminator != t) throw (TypeMismatchException("Trying to change type of Versatile object \"" + _name + "\"")); } - Versatile::operator long() const throw(TypeMismatchException) + Versatile::operator long() const { // If the type does not correspond or if the list has more than one element, // throw a TypeMismatchException @@ -192,7 +193,7 @@ namespace Batch { return *( static_cast(this->front()) ); } - Versatile::operator bool() const throw(TypeMismatchException) + Versatile::operator bool() const { // If the type does not correspond or if the list has more than one element, // throw a TypeMismatchException @@ -204,12 +205,12 @@ namespace Batch { return *( static_cast(this->front()) ); } - Versatile::operator int() const throw(TypeMismatchException) + Versatile::operator int() const { return operator long(); } - Versatile::operator Couple() const throw(TypeMismatchException) + Versatile::operator Couple() const { // If the type does not correspond or if the list has more than one element, // throw a TypeMismatchException @@ -221,7 +222,7 @@ namespace Batch { return *( static_cast(this->front()) ); } - string Versatile::str() const throw(TypeMismatchException) + string Versatile::str() const { // If the type does not correspond, throw a TypeMismatchException if ( _discriminator != STRING || size() == 0 ) { @@ -240,7 +241,7 @@ namespace Batch { return s; } - Versatile::operator string () const throw(TypeMismatchException) + Versatile::operator string () const { return str(); } diff --git a/src/Core/Versatile.hxx b/src/Core/Versatile.hxx index b5747de..b26fdd1 100644 --- a/src/Core/Versatile.hxx +++ b/src/Core/Versatile.hxx @@ -65,32 +65,32 @@ namespace Batch { virtual ~Versatile(); // Affectation and concatenation operators from base types - Versatile & operator = (const long l) throw(TypeMismatchException); - Versatile & operator = (const std::string & ch) throw(TypeMismatchException); - Versatile & operator +=(const std::string & ch) throw(TypeMismatchException,ListIsFullException); - Versatile & operator , (const std::string & ch) throw(TypeMismatchException,ListIsFullException); - Versatile & operator = (const char * ch) throw(TypeMismatchException); - Versatile & operator +=(const char * ch) throw(TypeMismatchException,ListIsFullException); - Versatile & operator , (const char * ch) throw(TypeMismatchException,ListIsFullException); - Versatile & operator = (const Couple & cp) throw(TypeMismatchException); - Versatile & operator +=(const Couple & cp) throw(TypeMismatchException,ListIsFullException); - Versatile & operator , (const Couple & cp) throw(TypeMismatchException,ListIsFullException); - Versatile & operator = (const int i) throw(TypeMismatchException); - Versatile & operator = (const bool b) throw(TypeMismatchException); + Versatile & operator = (const long l); + Versatile & operator = (const std::string & ch); + Versatile & operator +=(const std::string & ch); + Versatile & operator , (const std::string & ch); + Versatile & operator = (const char * ch); + Versatile & operator +=(const char * ch); + Versatile & operator , (const char * ch); + Versatile & operator = (const Couple & cp); + Versatile & operator +=(const Couple & cp); + Versatile & operator , (const Couple & cp); + Versatile & operator = (const int i); + Versatile & operator = (const bool b); // Type conversion to base types - operator long() const throw(TypeMismatchException); - operator std::string() const throw(TypeMismatchException); - operator Couple() const throw(TypeMismatchException); - std::string str() const throw(TypeMismatchException); - operator bool() const throw(TypeMismatchException); - operator int() const throw(TypeMismatchException); + operator long() const; + operator std::string() const; + operator Couple() const; + std::string str() const; + operator bool() const; + operator int() const; // Display on a stream BATCH_EXPORT friend std::ostream & operator << (std::ostream & os, const Versatile & ); // Check the type - void checkType(DiscriminatorType t) const throw (TypeMismatchException); + void checkType(DiscriminatorType t) const; // Getter methods DiscriminatorType getType() const; @@ -108,8 +108,8 @@ namespace Batch { private: - // Forbid the use of affectation operator - void operator= (const Versatile & V) {} + // Forbid the use of assignment operator + void operator= (const Versatile &) {} }; diff --git a/src/LSF/BatchManager_LSF.cxx b/src/LSF/BatchManager_LSF.cxx index f543983..646bbca 100644 --- a/src/LSF/BatchManager_LSF.cxx +++ b/src/LSF/BatchManager_LSF.cxx @@ -131,7 +131,7 @@ namespace Batch { // Methode pour le controle des jobs : teste si un job est present en machine - bool BatchManager_LSF::isRunning(const JobId & jobid) + bool BatchManager_LSF::isRunning(const JobId & /*jobid*/) { throw NotYetImplementedException("BatchManager_LSF::isRunning"); } diff --git a/src/Local/BatchManager_Local.cxx b/src/Local/BatchManager_Local.cxx index 6499333..40ba3fe 100644 --- a/src/Local/BatchManager_Local.cxx +++ b/src/Local/BatchManager_Local.cxx @@ -225,7 +225,7 @@ namespace Batch { // On force donc l'état du job à erreur - pour cela on ne donne pas d'Id // au JobId const Batch::JobId - BatchManager_Local::addJob(const Batch::Job & job, const std::string & reference) + BatchManager_Local::addJob(const Batch::Job & /*job*/, const std::string & /*reference*/) { return JobId(this, "undefined"); } diff --git a/src/OAR/BatchManager_OAR.cxx b/src/OAR/BatchManager_OAR.cxx index 03e74bc..1391b65 100644 --- a/src/OAR/BatchManager_OAR.cxx +++ b/src/OAR/BatchManager_OAR.cxx @@ -157,6 +157,7 @@ namespace Batch mem = params[MAXRAMSIZE]; if (params.find(QUEUE) != params.end()) queue = params[QUEUE].str(); + LIBBATCH_UNUSED(mem); string::size_type p1 = fileToExecute.find_last_of("/"); string::size_type p2 = fileToExecute.find_last_of("."); diff --git a/src/PBS/BatchManager_PBS.cxx b/src/PBS/BatchManager_PBS.cxx index 72bf971..c3cf644 100644 --- a/src/PBS/BatchManager_PBS.cxx +++ b/src/PBS/BatchManager_PBS.cxx @@ -128,7 +128,7 @@ namespace Batch { } // Methode pour le controle des jobs : teste si un job est present en machine - bool BatchManager_PBS::isRunning(const JobId & jobid) + bool BatchManager_PBS::isRunning(const JobId & /*jobid*/) { throw NotYetImplementedException("BatchManager_PBS::isRunning"); } diff --git a/src/SGE/BatchManager_SGE.cxx b/src/SGE/BatchManager_SGE.cxx index 23ad6df..cfac6d8 100644 --- a/src/SGE/BatchManager_SGE.cxx +++ b/src/SGE/BatchManager_SGE.cxx @@ -147,7 +147,7 @@ namespace Batch { } // Methode pour le controle des jobs : teste si un job est present en machine - bool BatchManager_SGE::isRunning(const JobId & jobid) + bool BatchManager_SGE::isRunning(const JobId & /*jobid*/) { throw NotYetImplementedException("BatchManager_SGE::isRunning"); } diff --git a/src/Vishnu/BatchManager_Vishnu.cxx b/src/Vishnu/BatchManager_Vishnu.cxx index 113e99e..4e93051 100644 --- a/src/Vishnu/BatchManager_Vishnu.cxx +++ b/src/Vishnu/BatchManager_Vishnu.cxx @@ -49,7 +49,7 @@ namespace Batch { BatchManager_Vishnu::BatchManager_Vishnu(const FactBatchManager * parent, const char * host, const char * username, - CommunicationProtocolType protocolType, + CommunicationProtocolType /*protocolType*/, const char * mpiImpl) : // Force SH protocol for Vishnu BatchManager(parent, host, username, SH, mpiImpl) -- 2.39.2