remove -std=c++0x compiler option since nobody is ready for it, and accordingly back into auto_ptr from unique_ptr

This commit is contained in:
Dick Hollenbeck 2012-11-15 10:04:10 -06:00
parent 4794d3774a
commit a93637b14f
12 changed files with 44 additions and 51 deletions

View File

@ -136,13 +136,6 @@ if(CMAKE_COMPILER_IS_GNUCXX)
"Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_RELEASE_BUILD_FLAGS}\"")
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
# needed when using #include <unordered_map>, or std::unique_ptr which replaces std::auto_ptr
if(WIN32)
set(CMAKE_CXX_FLAGS "-std=gnu++0x")
else(WIN32)
set(CMAKE_CXX_FLAGS "-std=c++0x")
endif(WIN32)
if(WIN32) # under Windows/mingw, -fPIC option is enabled by default
# Set default flags for Release build.
set(CMAKE_C_FLAGS_RELEASE "-Wall ${KICAD_GCC_RELEASE_BUILD_FLAGS} -DNDEBUG")

View File

@ -70,7 +70,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
for( unsigned i=0; i<fpnames.GetCount(); ++i )
{
std::unique_ptr<MODULE> m( pi->FootprintLoad( libPath, fpnames[i] ) );
std::auto_ptr<MODULE> m( pi->FootprintLoad( libPath, fpnames[i] ) );
// we're loading what we enumerated, all must be there.
wxASSERT( m.get() );

View File

@ -696,7 +696,7 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericDesignHeader()
XNODE* NETLIST_EXPORT_TOOL::makeGenericLibraries()
{
XNODE* xlibs = node( wxT( "libraries" ) ); // unique_ptr
XNODE* xlibs = node( wxT( "libraries" ) ); // auto_ptr
for( std::set<void*>::iterator it = m_Libraries.begin(); it!=m_Libraries.end(); ++it )
{
@ -716,7 +716,7 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericLibraries()
XNODE* NETLIST_EXPORT_TOOL::makeGenericLibParts()
{
XNODE* xlibparts = node( wxT( "libparts" ) ); // unique_ptr
XNODE* xlibparts = node( wxT( "libparts" ) ); // auto_ptr
wxString sLibpart = wxT( "libpart" );
wxString sLib = wxT( "lib" );
wxString sPart = wxT( "part" );
@ -833,7 +833,7 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericLibParts()
XNODE* NETLIST_EXPORT_TOOL::makeGenericListOfNets()
{
XNODE* xnets = node( wxT( "nets" ) ); // unique_ptr if exceptions ever get used.
XNODE* xnets = node( wxT( "nets" ) ); // auto_ptr if exceptions ever get used.
wxString netCodeTxt;
wxString netName;
wxString ref;
@ -1062,7 +1062,7 @@ bool NETLIST_EXPORT_TOOL::WriteKiCadNetList( const wxString& aOutFileName )
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
g_NetObjectslist[ii]->m_Flag = 0;
std::unique_ptr<XNODE> xroot( makeGenericRoot() );
std::auto_ptr<XNODE> xroot( makeGenericRoot() );
try
{

View File

@ -29,7 +29,7 @@
// Three strategies for providing a portable hashtable are given.
// C++, boost, and wx, in that order. C++ solution is no good for mingw.
// So will soon try boost for all platforms.
// So boost seems best for all platforms.
#if 0 // C++
@ -56,13 +56,13 @@ typedef std::unordered_map< std::string, EDA_RECT > RECT_MAP;
// see http://www.boost.org/doc/libs/1_49_0/doc/html/boost/unordered_map.html
/// Map a C string to a wxString, used in PLUGINs.
/// Map a std::string to a wxString, used in PLUGINs.
typedef boost::unordered_map< std::string, wxString > PROPERTIES;
/// Map a C string to an integer. Used in DSNLEXER.
/// Map a std::string to an integer. Used in DSNLEXER.
typedef boost::unordered_map< std::string, int > KEYWORD_MAP;
/// Map a C string to an EDA_RECT.
/// Map a std::string to an EDA_RECT.
/// The key is the classname of the derived wxformbuilder dialog.
typedef boost::unordered_map< std::string, EDA_RECT > RECT_MAP;

View File

@ -22,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <memory> // std::unique_ptr
#include <memory> // std::auto_ptr
#include <wx/string.h>

View File

@ -79,7 +79,7 @@ void LIB_TABLE::Parse( SCH_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR )
in->NeedSYMBOLorNUMBER();
std::unique_ptr<ROW> row( new ROW( this ) );
std::auto_ptr<ROW> row( new ROW( this ) );
row->SetLogicalName( in->CurText() );
@ -244,13 +244,13 @@ void LIB_TABLE::loadLib( ROW* aRow ) throw( IO_ERROR )
if( !libType.compare( "dir" ) )
{
// autor_ptr wrap source while we create sink, in case sink throws.
std::unique_ptr<LIB_SOURCE> source(
std::auto_ptr<LIB_SOURCE> source(
new DIR_LIB_SOURCE(
aRow->GetFullURI(),
aRow->GetOptions() ) );
/* @todo load LIB_SINK
std::unique_ptr<LIB_SINK> sink(
std::auto_ptr<LIB_SINK> sink(
new DIR_LIB_SINK(
aRow->GetFullURI(),
aRow->GetOptions() ) );
@ -311,7 +311,7 @@ LIB_TABLE::ROW* LIB_TABLE::FindRow( const STRING& aLogicalName ) const
}
bool LIB_TABLE::InsertRow( std::unique_ptr<ROW>& aRow, bool doReplace )
bool LIB_TABLE::InsertRow( std::auto_ptr<ROW>& aRow, bool doReplace )
{
// this does not need to be super fast.

View File

@ -337,7 +337,7 @@ protected: // only a table editor can use these
* exists. If false, then fail if the key already exists.
* @return bool - true if the operation succeeded.
*/
bool InsertRow( std::unique_ptr<ROW>& aRow, bool doReplace = false );
bool InsertRow( std::auto_ptr<ROW>& aRow, bool doReplace = false );
/**
* Function FindRow

View File

@ -86,7 +86,7 @@ bool PCB_CALCULATOR_FRAME::WriteDataFile()
// Switch the locale to standard C (needed to read/write floating point numbers
LOCALE_IO toggle;
std::unique_ptr<PCB_CALCULATOR_DATAFILE> datafile( new PCB_CALCULATOR_DATAFILE( &m_RegulatorList ) );
std::auto_ptr<PCB_CALCULATOR_DATAFILE> datafile( new PCB_CALCULATOR_DATAFILE( &m_RegulatorList ) );
try
{

View File

@ -1107,7 +1107,7 @@ BOARD* EAGLE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPE
m_board->SetFileName( aFileName );
// delete on exception, iff I own m_board, according to aAppendToMe
unique_ptr<BOARD> deleter( aAppendToMe ? NULL : m_board );
auto_ptr<BOARD> deleter( aAppendToMe ? NULL : m_board );
try
{
@ -1795,7 +1795,7 @@ void EAGLE_PLUGIN::orientModuleText( MODULE* m, const EELEMENT& e,
MODULE* EAGLE_PLUGIN::makeModule( CPTREE& aPackage, const std::string& aPkgName ) const
{
std::unique_ptr<MODULE> m( new MODULE( NULL ) );
std::auto_ptr<MODULE> m( new MODULE( NULL ) );
m->SetLibRef( FROM_UTF8( aPkgName.c_str() ) );

View File

@ -77,7 +77,7 @@ class FP_CACHE_ITEM
wxFileName m_file_name; ///< The the full file name and path of the footprint to cache.
bool m_writable; ///< Writability status of the footprint file.
wxDateTime m_mod_time; ///< The last file modified time stamp.
unique_ptr< MODULE > m_module;
auto_ptr< MODULE > m_module;
public:
FP_CACHE_ITEM( MODULE* aModule, const wxFileName& aFileName );

View File

@ -148,7 +148,7 @@ static inline unsigned ReadLine( LINE_READER* rdr, const char* caller )
#endif
using namespace std; // unique_ptr
using namespace std; // auto_ptr
static inline const char* ShowVertJustify( EDA_TEXT_VJUSTIFY_T vertical )
@ -237,7 +237,7 @@ BOARD* LEGACY_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPE
m_board->SetFileName( aFileName );
// delete on exception, iff I own m_board, according to aAppendToMe
unique_ptr<BOARD> deleter( aAppendToMe ? NULL : m_board );
auto_ptr<BOARD> deleter( aAppendToMe ? NULL : m_board );
FILE* fp = wxFopen( aFileName, wxT( "r" ) );
if( !fp )
@ -929,7 +929,7 @@ void LEGACY_PLUGIN::loadSETUP()
MODULE* LEGACY_PLUGIN::LoadMODULE()
{
unique_ptr<MODULE> module( new MODULE( m_board ) );
auto_ptr<MODULE> module( new MODULE( m_board ) );
while( READLINE( m_reader ) )
{
@ -1139,7 +1139,7 @@ MODULE* LEGACY_PLUGIN::LoadMODULE()
void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
{
unique_ptr<D_PAD> pad( new D_PAD( aModule ) );
auto_ptr<D_PAD> pad( new D_PAD( aModule ) );
while( READLINE( m_reader ) )
{
@ -1382,7 +1382,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule )
THROW_IO_ERROR( m_error );
}
unique_ptr<EDGE_MODULE> dwg( new EDGE_MODULE( aModule, shape ) ); // a drawing
auto_ptr<EDGE_MODULE> dwg( new EDGE_MODULE( aModule, shape ) ); // a drawing
const char* data;
@ -1678,7 +1678,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
$EndDRAWSEGMENT
*/
unique_ptr<DRAWSEGMENT> dseg( new DRAWSEGMENT( m_board ) );
auto_ptr<DRAWSEGMENT> dseg( new DRAWSEGMENT( m_board ) );
while( READLINE( m_reader ) )
{
@ -2069,9 +2069,9 @@ void LEGACY_PLUGIN::loadNETCLASS()
// create an empty NETCLASS without a name, but do not add it to the BOARD
// yet since that would bypass duplicate netclass name checking within the BOARD.
// store it temporarily in an unique_ptr until successfully inserted into the BOARD
// store it temporarily in an auto_ptr until successfully inserted into the BOARD
// just before returning.
unique_ptr<NETCLASS> nc( new NETCLASS( m_board, wxEmptyString ) );
auto_ptr<NETCLASS> nc( new NETCLASS( m_board, wxEmptyString ) );
while( READLINE( m_reader ) )
{
@ -2144,7 +2144,7 @@ void LEGACY_PLUGIN::loadNETCLASS()
// Must have been a name conflict, this is a bad board file.
// User may have done a hand edit to the file.
// unique_ptr will delete nc on this code path
// auto_ptr will delete nc on this code path
m_error.Printf( _( "duplicate NETCLASS name '%s'" ), nc->GetName().GetData() );
THROW_IO_ERROR( m_error );
@ -2160,7 +2160,7 @@ void LEGACY_PLUGIN::loadNETCLASS()
void LEGACY_PLUGIN::loadZONE_CONTAINER()
{
unique_ptr<ZONE_CONTAINER> zc( new ZONE_CONTAINER( m_board ) );
auto_ptr<ZONE_CONTAINER> zc( new ZONE_CONTAINER( m_board ) );
CPolyLine::HATCH_STYLE outline_hatch = CPolyLine::NO_HATCH;
bool sawCorner = false;
@ -2422,7 +2422,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
void LEGACY_PLUGIN::loadDIMENSION()
{
unique_ptr<DIMENSION> dim( new DIMENSION( m_board ) );
auto_ptr<DIMENSION> dim( new DIMENSION( m_board ) );
while( READLINE( m_reader ) )
{

View File

@ -262,7 +262,7 @@ S3D_MASTER* PCB_PARSER::parse3DModel() throw( PARSE_ERROR )
T token;
unique_ptr< S3D_MASTER > n3D( new S3D_MASTER( NULL ) );
auto_ptr< S3D_MASTER > n3D( new S3D_MASTER( NULL ) );
NeedSYMBOL();
n3D->m_Shape3DName = FromUTF8();
@ -1062,7 +1062,7 @@ void PCB_PARSER::parseNETCLASS() throw( IO_ERROR, PARSE_ERROR )
T token;
unique_ptr<NETCLASS> nc( new NETCLASS( m_board, wxEmptyString ) );
auto_ptr<NETCLASS> nc( new NETCLASS( m_board, wxEmptyString ) );
NeedSYMBOL();
nc->SetName( FromUTF8() );
@ -1123,7 +1123,7 @@ void PCB_PARSER::parseNETCLASS() throw( IO_ERROR, PARSE_ERROR )
// Must have been a name conflict, this is a bad board file.
// User may have done a hand edit to the file.
// unique_ptr will delete nc on this code path
// auto_ptr will delete nc on this code path
wxString error;
error.Printf( _( "duplicate NETCLASS name '%s' in file %s at line %d, offset %d" ),
@ -1141,7 +1141,7 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT() throw( IO_ERROR, PARSE_ERROR )
T token;
wxPoint pt;
unique_ptr< DRAWSEGMENT > segment( new DRAWSEGMENT( NULL ) );
auto_ptr< DRAWSEGMENT > segment( new DRAWSEGMENT( NULL ) );
switch( CurTok() )
{
@ -1302,7 +1302,7 @@ TEXTE_PCB* PCB_PARSER::parseTEXTE_PCB() throw( IO_ERROR, PARSE_ERROR )
T token;
unique_ptr< TEXTE_PCB > text( new TEXTE_PCB( m_board ) );
auto_ptr< TEXTE_PCB > text( new TEXTE_PCB( m_board ) );
NeedSYMBOLorNUMBER();
text->SetText( FromUTF8() );
@ -1370,7 +1370,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
T token;
unique_ptr< DIMENSION > dimension( new DIMENSION( NULL ) );
auto_ptr< DIMENSION > dimension( new DIMENSION( NULL ) );
dimension->m_Value = parseBoardUnits( "dimension value" );
NeedLEFT();
@ -1519,7 +1519,7 @@ MODULE* PCB_PARSER::parseMODULE() throw( IO_ERROR, PARSE_ERROR )
wxPoint pt;
T token;
unique_ptr< MODULE > module( new MODULE( m_board ) );
auto_ptr< MODULE > module( new MODULE( m_board ) );
NeedSYMBOL();
module->SetLibRef( FromUTF8() );
@ -1735,7 +1735,7 @@ TEXTE_MODULE* PCB_PARSER::parseTEXTE_MODULE() throw( IO_ERROR, PARSE_ERROR )
T token = NextTok();
unique_ptr< TEXTE_MODULE > text( new TEXTE_MODULE( NULL ) );
auto_ptr< TEXTE_MODULE > text( new TEXTE_MODULE( NULL ) );
switch( token )
{
@ -1820,7 +1820,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE() throw( IO_ERROR, PARSE_ERROR )
wxPoint pt;
T token;
unique_ptr< EDGE_MODULE > segment( new EDGE_MODULE( NULL ) );
auto_ptr< EDGE_MODULE > segment( new EDGE_MODULE( NULL ) );
switch( CurTok() )
{
@ -1985,7 +1985,7 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR )
wxSize sz;
wxPoint pt;
unique_ptr< D_PAD > pad( new D_PAD( NULL ) );
auto_ptr< D_PAD > pad( new D_PAD( NULL ) );
NeedSYMBOLorNUMBER();
pad->SetPadName( FromUTF8() );
@ -2213,7 +2213,7 @@ TRACK* PCB_PARSER::parseTRACK() throw( IO_ERROR, PARSE_ERROR )
wxPoint pt;
T token;
unique_ptr< TRACK > track( new TRACK( m_board ) );
auto_ptr< TRACK > track( new TRACK( m_board ) );
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
{
@ -2275,7 +2275,7 @@ SEGVIA* PCB_PARSER::parseSEGVIA() throw( IO_ERROR, PARSE_ERROR )
wxPoint pt;
T token;
unique_ptr< SEGVIA > via( new SEGVIA( m_board ) );
auto_ptr< SEGVIA > via( new SEGVIA( m_board ) );
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
{
@ -2360,7 +2360,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
// bigger scope since each filled_polygon is concatenated in here
std::vector< CPolyPt > pts;
unique_ptr< ZONE_CONTAINER > zone( new ZONE_CONTAINER( m_board ) );
auto_ptr< ZONE_CONTAINER > zone( new ZONE_CONTAINER( m_board ) );
zone->SetPriority( 0 );
@ -2665,7 +2665,7 @@ PCB_TARGET* PCB_PARSER::parsePCB_TARGET() throw( IO_ERROR, PARSE_ERROR )
wxPoint pt;
T token;
unique_ptr< PCB_TARGET > target( new PCB_TARGET( NULL ) );
auto_ptr< PCB_TARGET > target( new PCB_TARGET( NULL ) );
for( token = NextTok(); token != T_RIGHT; token = NextTok() )