diff --git a/Changes b/Changes index 95c97d840..de29f5b1f 100644 --- a/Changes +++ b/Changes @@ -13,6 +13,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Fix tracing of package variables and real arrays. +**** Fix C++-2011 warnings. + * Verilator 3.856 2014-03-11 diff --git a/include/verilatedos.h b/include/verilatedos.h index f804ebf3d..c2068f101 100644 --- a/include/verilatedos.h +++ b/include/verilatedos.h @@ -95,6 +95,16 @@ // This is not necessarily the same as #UL, depending on what the IData typedef is. #define VL_UL(c) ((IData)(c##UL)) ///< Add appropriate suffix to 32-bit constant +//========================================================================= +// C++-2011 + +#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) +# define VL_HAS_UNIQUE_PTR +# define VL_UNIQUE_PTR unique_ptr +#else +# define VL_UNIQUE_PTR auto_ptr +#endif + //========================================================================= // Warning disabled diff --git a/src/V3Broken.cpp b/src/V3Broken.cpp index 54a4641de..97b10dd1d 100644 --- a/src/V3Broken.cpp +++ b/src/V3Broken.cpp @@ -47,11 +47,11 @@ private: typedef map NodeMap; static NodeMap s_nodes; // Set of all nodes that exist // BITMASK - static const int FLAG_ALLOCATED = 0x01; // new() and not delete()ed - static const int FLAG_IN_TREE = 0x02; // Is in netlist tree - static const int FLAG_LINKABLE = 0x04; // Is in netlist tree, can be linked to - static const int FLAG_LEAKED = 0x08; // Known to have been leaked - static const int FLAG_UNDER_NOW = 0x10; // Is in tree as parent of current node + enum { FLAG_ALLOCATED = 0x01 }; // new() and not delete()ed + enum { FLAG_IN_TREE = 0x02 }; // Is in netlist tree + enum { FLAG_LINKABLE = 0x04 }; // Is in netlist tree, can be linked to + enum { FLAG_LEAKED = 0x08 }; // Known to have been leaked + enum { FLAG_UNDER_NOW = 0x10 }; // Is in tree as parent of current node public: // METHODS static void deleted(const AstNode* nodep) { diff --git a/src/V3File.cpp b/src/V3File.cpp index 6e4166b52..3cb29d57f 100644 --- a/src/V3File.cpp +++ b/src/V3File.cpp @@ -120,7 +120,7 @@ V3FileDependImp dependImp; // Depend implementation class // V3FileDependImp inline void V3FileDependImp::writeDepend(const string& filename) { - const auto_ptr ofp (V3File::new_ofstream(filename)); + const VL_UNIQUE_PTR ofp (V3File::new_ofstream(filename)); if (ofp->fail()) v3fatalSrc("Can't write "<::iterator iter=m_filenameList.begin(); @@ -156,7 +156,7 @@ inline void V3FileDependImp::writeDepend(const string& filename) { } inline void V3FileDependImp::writeTimes(const string& filename, const string& cmdlineIn) { - const auto_ptr ofp (V3File::new_ofstream(filename)); + const VL_UNIQUE_PTR ofp (V3File::new_ofstream(filename)); if (ofp->fail()) v3fatalSrc("Can't write "<=6 || force) { string filename = v3Global.debugFilename(nameComment)+".txt"; - const auto_ptr logp (V3File::new_ofstream(filename)); + const VL_UNIQUE_PTR logp (V3File::new_ofstream(filename)); if (logp->fail()) v3fatalSrc("Can't write "< logp (V3File::new_ofstream(filename)); + const VL_UNIQUE_PTR logp (V3File::new_ofstream(filename)); if (logp->fail()) v3fatalSrc("Can't write "<first; AstScope* scopep = it->second; if (nodep->packagep()) { - PackageScopeMap::iterator it = m_packageScopes.find(nodep->packagep()); - if (it==m_packageScopes.end()) nodep->v3fatalSrc("Can't locate package scope"); - scopep = it->second; + PackageScopeMap::iterator it2 = m_packageScopes.find(nodep->packagep()); + if (it2==m_packageScopes.end()) nodep->v3fatalSrc("Can't locate package scope"); + scopep = it2->second; } - VarScopeMap::iterator it = m_varScopes.find(make_pair(nodep->varp(), scopep)); - if (it==m_varScopes.end()) nodep->v3fatalSrc("Can't locate varref scope"); - AstVarScope* varscp = it->second; + VarScopeMap::iterator it3 = m_varScopes.find(make_pair(nodep->varp(), scopep)); + if (it3==m_varScopes.end()) nodep->v3fatalSrc("Can't locate varref scope"); + AstVarScope* varscp = it3->second; nodep->varScopep(varscp); } }