Salome HOME
Fight warnings (c++-11 and newer)
authorvsr <vsr@opencascade.com>
Mon, 20 Apr 2020 18:01:19 +0000 (18:01 +0000)
committervsr <vsr@opencascade.com>
Mon, 20 Apr 2020 18:01:19 +0000 (18:01 +0000)
src/COORM/BatchManager_COORM.cxx
src/Core/Constants.hxx
src/Core/Test/SimpleParser.cxx
src/Core/Test/SimpleParser.hxx
src/Core/Test/Test_SimpleParser.cxx
src/Core/Versatile.cxx
src/Core/Versatile.hxx
src/OAR/BatchManager_OAR.cxx

index 5676073a905b72b14157ce04f541c11ee5370320..9fbbabd8ae5b53c2449ac47615f83e52f5c75536 100644 (file)
@@ -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())
index 591f248e2c3715624dd44965dbd2a40ad75f45ec..b29fdc4f1fc9ce42a66b0b4602d252508b65a538 100644 (file)
@@ -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 {
 
index 28360fd3a55f50e66b32779acb539e6f9195c122..343469dd96f6e43ff82e2cca06d45bf28bbd7736 100644 (file)
 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<string,string>::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;
index ec0f0b02d34c5ff9f74e2f7ca1373cc2e8d580e3..fb314249f388c296b6355859be6831597a10aad5 100644 (file)
 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<std::string, std::string> _configmap;
 };
index f635e42208af4a678335d62449d23b3acdb22719..ac6f749b515a0de1136f77ec3b1f1d2eea68a4a2 100644 (file)
@@ -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;
   }
index 010849bb62deec0487cd1e6ec0a47c22ffae8d35..98289734e46eba5d8ac9d95f794a546acc6fa46f 100644 (file)
@@ -66,7 +66,7 @@ namespace Batch {
     eraseAll();
   }
 
-  Versatile & Versatile::operator = (const long l) throw(TypeMismatchException)
+  Versatile & Versatile::operator = (const long l)
   {
     checkType(LONG);
     eraseAll();
@@ -74,7 +74,7 @@ namespace Batch {
     return *this;
   }
 
-  Versatile & Versatile::operator = (const string & ch) throw(TypeMismatchException)
+  Versatile & Versatile::operator = (const string & ch)
   {
     checkType(STRING);
     eraseAll();
@@ -82,7 +82,7 @@ namespace Batch {
     return *this;
   }
 
-  Versatile & Versatile::operator +=(const string & ch) throw(TypeMismatchException,ListIsFullException)
+  Versatile & Versatile::operator +=(const string & ch)
   {
     checkType(STRING);
 
@@ -97,28 +97,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 +126,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 +140,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 +158,7 @@ namespace Batch {
     return os;
   }
 
-  Versatile & Versatile::operator = (const int i) throw(TypeMismatchException)
+  Versatile & Versatile::operator = (const int i)
   {
     checkType(LONG);
     eraseAll();
@@ -166,7 +166,7 @@ namespace Batch {
     return *this;
   }
 
-  Versatile & Versatile::operator = (const bool b) throw(TypeMismatchException)
+  Versatile & Versatile::operator = (const bool b)
   {
     checkType(BOOL);
     eraseAll();
@@ -174,13 +174,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 +192,7 @@ namespace Batch {
        return *( static_cast<LongType *>(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 +204,12 @@ namespace Batch {
     return *( static_cast<BoolType *>(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 +221,7 @@ namespace Batch {
     return *( static_cast<CoupleType *>(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 +240,7 @@ namespace Batch {
     return s;
   }
 
-  Versatile::operator string () const throw(TypeMismatchException)
+  Versatile::operator string () const
   {
     return str();
   }
index b5747de0ab1b4b1dd73d4650c642d2e7d886b445..d72f8e994be12f4f8c87d23c7dd32cd7e2a2f472 100644 (file)
@@ -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;
index 03e74bcf91c7ae296c5c84f96295a42048de2fda..1391b651c42a00f4dfca7151bd8230dec4e13dff 100644 (file)
@@ -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(".");