Re: [Kicad-developers] [PATCH 3/3] C++11: replace std::auto_ptr

2015-03-06 Thread Simon Richter
Hi,

On 06.03.2015 13:13, Wayne Stambaugh wrote:

 Please do *not* commit any patches for C++ 0x11.  Using C++ 0x11 is not
 an option at this point.  We still have to support older compilers that
 do not support 0x11.  I do not want to abandoned a large segment of our
 user base.

Yes, those weren't intended for merging, but as a proof of concept that
it could be done (I had to add the override markers to get rid of the
warnings generated by -Wsuggest-override, which is the best way to find
overriding functions in derived classes).

I was under the impression that suggesting to switch over was so
preposterous that that would be immediately clear. :)

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [PATCH 3/3] C++11: replace std::auto_ptr

2015-03-06 Thread Wayne Stambaugh
Please do *not* commit any patches for C++ 0x11.  Using C++ 0x11 is not
an option at this point.  We still have to support older compilers that
do not support 0x11.  I do not want to abandoned a large segment of our
user base.

On 3/6/2015 5:28 AM, Simon Richter wrote:
 ---
  common/fp_lib_table.cpp| 2 +-
  common/project.cpp | 2 +-
  eeschema/lib_export.cpp| 8 
  pcbnew/gpcb_plugin.cpp | 2 +-
  pcbnew/legacy_plugin.cpp   | 2 +-
  pcbnew/router/pns_topology.cpp | 8 
  6 files changed, 12 insertions(+), 12 deletions(-)
 
 diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp
 index 3b7f7e5..dde6a41 100644
 --- a/common/fp_lib_table.cpp
 +++ b/common/fp_lib_table.cpp
 @@ -193,7 +193,7 @@ FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const 
 wxString aNickname, con
  
  wxString fpname = aFootprint-GetFPID().GetFootprintName();
  
 -std::auto_ptrMODULE   m( row-plugin-FootprintLoad( 
 row-GetFullURI( true ), fpname, row-GetProperties() ) );
 +std::unique_ptrMODULE   m( row-plugin-FootprintLoad( 
 row-GetFullURI( true ), fpname, row-GetProperties() ) );
  
  if( m.get() )
  return SAVE_SKIPPED;
 diff --git a/common/project.cpp b/common/project.cpp
 index 27f91a8..8bf0120 100644
 --- a/common/project.cpp
 +++ b/common/project.cpp
 @@ -317,7 +317,7 @@ void PROJECT::ConfigSave( const SEARCH_STACK aSList, 
 const wxString aGroupName
  bool PROJECT::ConfigLoad( const SEARCH_STACK aSList, const wxString  
 aGroupName,
  const PARAM_CFG_ARRAY aParams, const wxString 
 aForeignProjectFileName )
  {
 -std::auto_ptrwxConfigBase cfg( configCreate( aSList, aGroupName, 
 aForeignProjectFileName ) );
 +std::unique_ptrwxConfigBase cfg( configCreate( aSList, aGroupName, 
 aForeignProjectFileName ) );
  
  if( !cfg.get() )
  {
 diff --git a/eeschema/lib_export.cpp b/eeschema/lib_export.cpp
 index 022e467..23a7d40 100644
 --- a/eeschema/lib_export.cpp
 +++ b/eeschema/lib_export.cpp
 @@ -57,12 +57,12 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent event )
  
  wxFileName  fn = dlg.GetPath();
  
 -std::auto_ptrPART_LIB lib;
 +std::unique_ptrPART_LIB lib;
  
  try
  {
 -std::auto_ptrPART_LIB new_lib( PART_LIB::LoadLibrary( 
 fn.GetFullPath() ) );
 -lib = new_lib;
 +std::unique_ptrPART_LIB new_lib( PART_LIB::LoadLibrary( 
 fn.GetFullPath() ) );
 +lib = std::move(new_lib);
  }
  catch( const IO_ERROR ioe )
  {
 @@ -126,7 +126,7 @@ void LIB_EDIT_FRAME::OnExportPart( wxCommandEvent event )
  
  fn = dlg.GetPath();
  
 -std::auto_ptrPART_LIB temp_lib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, 
 fn.GetFullPath() ) );
 +std::unique_ptrPART_LIB temp_lib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, 
 fn.GetFullPath() ) );
  
  SaveOnePart( temp_lib.get() );
  
 diff --git a/pcbnew/gpcb_plugin.cpp b/pcbnew/gpcb_plugin.cpp
 index 97c6804..1af1421 100644
 --- a/pcbnew/gpcb_plugin.cpp
 +++ b/pcbnew/gpcb_plugin.cpp
 @@ -388,7 +388,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* 
 aLineReader ) throw( IO_ERROR,
  wxPoint   textPos;
  wxString  msg;
  wxArrayString parameters;
 -std::auto_ptrMODULE module( new MODULE( NULL ) );
 +std::unique_ptrMODULE module( new MODULE( NULL ) );
  
  
  if( aLineReader-ReadLine() == NULL )
 diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp
 index ecc1d66..bf50297 100644
 --- a/pcbnew/legacy_plugin.cpp
 +++ b/pcbnew/legacy_plugin.cpp
 @@ -4353,7 +4353,7 @@ void LP_CACHE::LoadModules( LINE_READER* aReader )
  // test first for the $MODULE, even before reading because of INDEX 
 bug.
  if( TESTLINE( $MODULE ) )
  {
 -auto_ptrMODULEmodule( new MODULE( m_owner-m_board ) );
 +std::unique_ptrMODULEmodule( new MODULE( m_owner-m_board 
 ) );
  
  std::string footprintName = StrPurge( line + SZ( 
 $MODULE ) );
  
 diff --git a/pcbnew/router/pns_topology.cpp b/pcbnew/router/pns_topology.cpp
 index f59a0fd..87f3ac5 100644
 --- a/pcbnew/router/pns_topology.cpp
 +++ b/pcbnew/router/pns_topology.cpp
 @@ -36,14 +36,14 @@ bool PNS_TOPOLOGY::SimplifyLine( PNS_LINE* aLine )
  return false;
  
  PNS_SEGMENT* root = ( *aLine-LinkedSegments() )[0];
 -std::auto_ptrPNS_LINE l( m_world-AssembleLine( root ) );
 +std::unique_ptrPNS_LINE l( m_world-AssembleLine( root ) );
  SHAPE_LINE_CHAIN simplified( l-CLine() );
  
  simplified.Simplify();
  
  if( simplified.PointCount() != l-PointCount() )
  {
 -std::auto_ptrPNS_LINE lnew( l-Clone() );
 +std::unique_ptrPNS_LINE lnew( l-Clone() );
  m_world-Remove( l.get() );
  lnew-SetShape( simplified );
  m_world-Add( lnew.get() );
 @@ -359,8 +359,8 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, 
 PNS_DIFF_PAIR aPair )
  if( !coupledSeg )