From 2577d40ded85478bd7ce2b5b48053b913b883076 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Sat, 15 Jul 2023 16:31:05 +0200 Subject: [PATCH] Fix some compiler warnings --- src/gearimpl/FixedPadSizeDiskLayout.cc | 4 ++-- src/gearimpl/GearMgrImpl.cc | 6 +++--- src/gearxml/GearParametersXML.cc | 2 +- src/gearxml/GearXML.cc | 2 +- src/gearxml/tinyxmlparser.cc | 3 +++ src/test/testgear.cc | 4 ++-- src/test/testtpcproto.cc | 4 ++-- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/gearimpl/FixedPadSizeDiskLayout.cc b/src/gearimpl/FixedPadSizeDiskLayout.cc index bff31d1..7466118 100644 --- a/src/gearimpl/FixedPadSizeDiskLayout.cc +++ b/src/gearimpl/FixedPadSizeDiskLayout.cc @@ -173,7 +173,7 @@ namespace gear { return _padWidth / _rows.at( rowNum ).RCenter ; } - catch(std::out_of_range){ + catch(std::out_of_range const&){ return 0. ; } } @@ -188,7 +188,7 @@ namespace gear { return _rows.at( rowNum ).PhiPad; } - catch(std::out_of_range){ + catch(std::out_of_range const&){ return 0. ; } } diff --git a/src/gearimpl/GearMgrImpl.cc b/src/gearimpl/GearMgrImpl.cc index 5f834f7..d7cb6a2 100644 --- a/src/gearimpl/GearMgrImpl.cc +++ b/src/gearimpl/GearMgrImpl.cc @@ -467,7 +467,7 @@ namespace gear{ lcalParameters->getDoubleVal("beam_crossing_angle") ; - }catch( UnknownParameterException ){ + }catch( UnknownParameterException const& ){ std::cout << "WARNING GearMgrImpl::setLcalParameters: added " " missing parameter beam_crossing_angle 0.0 ! " << std::endl ; @@ -488,7 +488,7 @@ namespace gear{ lhcalParameters->getDoubleVal("beam_crossing_angle") ; - }catch( UnknownParameterException ){ + }catch( UnknownParameterException const& ){ std::cout << "WARNING GearMgrImpl::setLHcalParameters: added " " missing parameter beam_crossing_angle 0.0 ! " << std::endl ; @@ -509,7 +509,7 @@ namespace gear{ beamcalParameters->getDoubleVal("beam_crossing_angle") ; - }catch( UnknownParameterException ){ + }catch( UnknownParameterException const& ){ std::cout << "WARNING GearMgrImpl::setBeamCalParameters: added " " missing parameter beam_crossing_angle 0.0 ! " << std::endl ; diff --git a/src/gearxml/GearParametersXML.cc b/src/gearxml/GearParametersXML.cc index ad764ad..29be197 100644 --- a/src/gearxml/GearParametersXML.cc +++ b/src/gearxml/GearParametersXML.cc @@ -233,7 +233,7 @@ namespace gear { value = getXMLAttribute( par , "value" ) ; } - catch( ParseException ) { + catch( ParseException const& ) { if( par->FirstChild() ) value = par->FirstChild()->Value() ; diff --git a/src/gearxml/GearXML.cc b/src/gearxml/GearXML.cc index 747f76e..d2cc492 100644 --- a/src/gearxml/GearXML.cc +++ b/src/gearxml/GearXML.cc @@ -68,7 +68,7 @@ namespace gear{ try{ detName = mgr->getDetectorName() ; } - catch( UnknownParameterException ){} + catch( UnknownParameterException const& ){} global.SetAttribute( "detectorName" , detName ) ; diff --git a/src/gearxml/tinyxmlparser.cc b/src/gearxml/tinyxmlparser.cc index 8731850..311ae5a 100644 --- a/src/gearxml/tinyxmlparser.cc +++ b/src/gearxml/tinyxmlparser.cc @@ -110,14 +110,17 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng --output; *output = (char)((input | BYTE_MARK) & BYTE_MASK); input >>= 6; + [[fallthrough]]; case 3: --output; *output = (char)((input | BYTE_MARK) & BYTE_MASK); input >>= 6; + [[fallthrough]]; case 2: --output; *output = (char)((input | BYTE_MARK) & BYTE_MASK); input >>= 6; + [[fallthrough]]; case 1: --output; *output = (char)(input | FIRST_BYTE_MARK[*length]); diff --git a/src/test/testgear.cc b/src/test/testgear.cc index edd7e91..e43deeb 100644 --- a/src/test/testgear.cc +++ b/src/test/testgear.cc @@ -239,12 +239,12 @@ void testFixedPadSizeDiskLayout( const FixedPadSizeDiskLayout& pl ) { // in the other implementations, because there are pads at the edge of the pad plane // which have no neighbour. if( j == 0 ) { - int ln = pl.getRightNeighbour( pl.getPadIndex( iRow , iPad ) ) ; + pl.getRightNeighbour( pl.getPadIndex( iRow , iPad ) ) ; assert( pl.getPadNumber( ln ) == nPad-1 ) ; } if( j == nPad-1 ) { - int rn = pl.getLeftNeighbour( pl.getPadIndex( iRow , iPad ) ) ; + pl.getLeftNeighbour( pl.getPadIndex( iRow , iPad ) ) ; assert( pl.getPadNumber( rn ) == 0 ) ; } diff --git a/src/test/testtpcproto.cc b/src/test/testtpcproto.cc index 18fde8b..320d9e8 100644 --- a/src/test/testtpcproto.cc +++ b/src/test/testtpcproto.cc @@ -156,14 +156,14 @@ void testRectangularPadRowLayout( const RectangularPadRowLayout& pl ) { if( j != 0 ) { - int ln = pl.getLeftNeighbour( pl.getPadIndex( iRow , iPad ) ) ; + pl.getLeftNeighbour( pl.getPadIndex( iRow , iPad ) ) ; assert( pl.getPadNumber( ln ) == iPad - 1 ) ; } if( j != nPad-1 ) { - int rn = pl.getRightNeighbour( pl.getPadIndex( iRow , iPad ) ) ; + pl.getRightNeighbour( pl.getPadIndex( iRow , iPad ) ) ; assert( pl.getPadNumber( rn ) == iPad + 1 ) ; }