← Back to team overview

kicad-developers team mailing list archive

[PATCH] Another -Wcatch-value fix

 

Hi,

Another small fix for a -Wcatch-value warning that I noticed during a
clean build.

Cheers,

John
From eebe86ea52c028b42389d0000b6139b3b2b4f9bd Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Thu, 19 Jul 2018 17:15:36 +0100
Subject: [PATCH] Fix -Wcatch-value in sexpr.cpp

This is fixed by catching bty const-ref, rather than by value.

Also a few trailing space deletions.
---
 utils/kicad2step/sexpr/sexpr.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/utils/kicad2step/sexpr/sexpr.cpp b/utils/kicad2step/sexpr/sexpr.cpp
index 8620ab7fa..a5d72c75c 100644
--- a/utils/kicad2step/sexpr/sexpr.cpp
+++ b/utils/kicad2step/sexpr/sexpr.cpp
@@ -43,7 +43,7 @@ namespace SEXPR
 
         return &static_cast< SEXPR_LIST const * >(this)->m_children;
     }
-    
+
     SEXPR* SEXPR::GetChild( size_t aIndex ) const
     {
         if( m_type != SEXPR_TYPE::SEXPR_TYPE_LIST )
@@ -208,12 +208,12 @@ namespace SEXPR
 
         m_children.clear();
     }
-    
+
     SEXPR_LIST& operator<< ( SEXPR_LIST& list, const ISEXPRABLE& obj )
     {
         SEXPR* sobj = obj.SerializeSEXPR();
         list.AddChild( sobj );
-        
+
         return list;
     }
 
@@ -252,7 +252,7 @@ namespace SEXPR
         list.AddChild( obj );
         return list;
     }
-    
+
     SEXPR_LIST& operator<< ( SEXPR_LIST& list, const _OUT_STRING setting )
     {
         SEXPR *res;
@@ -469,7 +469,7 @@ namespace SEXPR
 					throw std::invalid_argument( "unsupported argument type, this shouldn't have happened" );
 				}
 			}
-			catch( INVALID_TYPE_EXCEPTION )
+			catch( const INVALID_TYPE_EXCEPTION& )
 			{
 				return i;
 			}
-- 
2.17.1


Follow ups