From fcf35bffdb4e95456de2688a3f6ef4d169f2fa1b Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Fri, 5 Jan 2024 14:56:36 +0100
Subject: [PATCH] silence compiler warnings

---
 modules/mol/base/src/chain_type.cc | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/modules/mol/base/src/chain_type.cc b/modules/mol/base/src/chain_type.cc
index 39be8389c..aa0715fe5 100644
--- a/modules/mol/base/src/chain_type.cc
+++ b/modules/mol/base/src/chain_type.cc
@@ -138,11 +138,13 @@ String EntityTypeFromChainType(ChainType type) {
      case ost::mol::CHAINTYPE_POLY_PEPTIDE_DN_RN: return "polymer";
      case ost::mol::CHAINTYPE_BRANCHED: return "branched";
      case ost::mol::CHAINTYPE_OLIGOSACCHARIDE: return "branched";
+     default: {
+       std::stringstream ss;
+       ss <<"Unknown ChainType item found: '" << type << "'!";
+       throw Error(ss.str());
+     }
   }
 
-  std::stringstream ss("Unknown ChainType item found: '");
-  ss << type << "'!";
-  throw Error(ss.str());
 }
 
 String EntityPolyTypeFromChainType(ChainType type) {
@@ -157,22 +159,25 @@ String EntityPolyTypeFromChainType(ChainType type) {
      case ost::mol::CHAINTYPE_POLY_DN_RN: return "polydeoxyribonucleotide/polyribonucleotide hybrid";
      case ost::mol::CHAINTYPE_CYCLIC_PSEUDO_PEPTIDE: return "cyclic-pseudo-peptide";
      case ost::mol::CHAINTYPE_POLY_PEPTIDE_DN_RN: return "peptide nucleic acid";
+     default: {
+       std::stringstream ss;
+       ss << "Cannot return entity poly type from chain of type: '" << type << "'!";
+       throw Error(ss.str());
+     }
   }
-
-  std::stringstream ss("Cannot return entity poly type from chain of type: '");
-  ss << type << "'!";
-  throw Error(ss.str());
 }
 
 String BranchedTypeFromChainType(ChainType type) {
   switch(type) {
      case ost::mol::CHAINTYPE_BRANCHED: return "oligosaccharide"; // the only one
      case ost::mol::CHAINTYPE_OLIGOSACCHARIDE: return "oligosaccharide";
+     default: {
+       std::stringstream ss;
+       ss << "Cannot return branched type from chain of type: '" << type << "'!";
+       throw Error(ss.str());
+     }
   }
 
-  std::stringstream ss("Cannot return branched type from chain of type: '");
-  ss << type << "'!";
-  throw Error(ss.str());
 }
 
 }} //ns
-- 
GitLab