Fix C++-2011 warnings.

This commit is contained in:
Wilson Snyder 2014-03-15 14:50:03 -04:00
parent 3996e94c39
commit c18df68ead
7 changed files with 27 additions and 15 deletions

View File

@ -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

View File

@ -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

View File

@ -47,11 +47,11 @@ private:
typedef map<const AstNode*,int> 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) {

View File

@ -120,7 +120,7 @@ V3FileDependImp dependImp; // Depend implementation class
// V3FileDependImp
inline void V3FileDependImp::writeDepend(const string& filename) {
const auto_ptr<ofstream> ofp (V3File::new_ofstream(filename));
const VL_UNIQUE_PTR<ofstream> ofp (V3File::new_ofstream(filename));
if (ofp->fail()) v3fatalSrc("Can't write "<<filename);
for (set<DependFile>::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<ofstream> ofp (V3File::new_ofstream(filename));
const VL_UNIQUE_PTR<ofstream> ofp (V3File::new_ofstream(filename));
if (ofp->fail()) v3fatalSrc("Can't write "<<filename);
string cmdline = stripQuotes(cmdlineIn);

View File

@ -127,7 +127,7 @@ public:
void dump(const string& nameComment="linkdot", bool force=false) {
if (debug()>=6 || force) {
string filename = v3Global.debugFilename(nameComment)+".txt";
const auto_ptr<ofstream> logp (V3File::new_ofstream(filename));
const VL_UNIQUE_PTR<ofstream> logp (V3File::new_ofstream(filename));
if (logp->fail()) v3fatalSrc("Can't write "<<filename);
ostream& os = *logp;
m_syms.dump(os);

View File

@ -1323,7 +1323,7 @@ void OrderVisitor::processDomainsIterate(OrderEitherVertex* vertexp) {
void OrderVisitor::processEdgeReport() {
// Make report of all signal names and what clock edges they have
string filename = v3Global.debugFilename("order_edges.txt");
const auto_ptr<ofstream> logp (V3File::new_ofstream(filename));
const VL_UNIQUE_PTR<ofstream> logp (V3File::new_ofstream(filename));
if (logp->fail()) v3fatalSrc("Can't write "<<filename);
//Testing emitter: V3EmitV::verilogForTree(v3Global.rootp(), *logp);

View File

@ -78,13 +78,13 @@ private:
AstVarRef* nodep = it->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);
}
}