Don't unconditionally include all of namespace std Signed-off-by: Peter Foley <pefol...@pefoley.com> --- common/h/IBSTree.h | 6 +++--- dataflowAPI/src/SymEval.C | 16 +++++++++------- dataflowAPI/src/debug_dataflow.h | 10 +++++----- dataflowAPI/src/stackanalysis.C | 7 ++++--- dyninstAPI/h/BPatch_snippet.h | 2 +- dyninstAPI/src/StackMod/StackAccess.C | 4 ++-- dyninstAPI/src/parse-cfg.h | 8 ++++---- parseAPI/h/CFG.h | 6 ++++-- parseAPI/h/CodeSource.h | 4 ++-- parseAPI/src/CFGFactory.C | 6 +++--- parseAPI/src/IA_x86.C | 2 +- parseAPI/src/LoopAnalyzer.C | 2 +- parseAPI/src/ThunkData.h | 4 ++-- patchAPI/h/PatchCFG.h | 2 +- patchAPI/src/AddrSpace.C | 6 +++--- patchAPI/src/PatchBlock.C | 9 ++++++--- patchAPI/src/PatchCallback.C | 2 +- patchAPI/src/PatchEdge.C | 2 +- patchAPI/src/PatchFunction.C | 5 +++-- patchAPI/src/PatchModifier.C | 2 +- patchAPI/src/PatchObject.C | 10 +++++----- symtabAPI/h/Aggregate.h | 2 +- symtabAPI/h/Function.h | 2 +- 23 files changed, 64 insertions(+), 55 deletions(-)
diff --git a/common/h/IBSTree.h b/common/h/IBSTree.h index 613e545..7732fc6 100644 --- a/common/h/IBSTree.h +++ b/common/h/IBSTree.h @@ -45,7 +45,7 @@ #include <set> #include <limits> -using namespace std; +using std::set; /** Template class for Interval Binary Search Tree. The implementation is * based on a red-black tree (derived from our codeRange implementation) @@ -551,7 +551,7 @@ IBSTree<ITYPE>::rightUp(IBSNode<ITYPE> *R) return R->parent->value(); R = R->parent; } - return numeric_limits<interval_type>::max(); + return std::numeric_limits<interval_type>::max(); } /* Same as rightUp, only looking for the nearest ancestor node that @@ -566,7 +566,7 @@ IBSTree<ITYPE>::leftUp(IBSNode<ITYPE> *R) R = R->parent; } // XXX is this right? for unsigned values, min() is a possible value - return numeric_limits<interval_type>::min(); + return std::numeric_limits<interval_type>::min(); } /* Restore RB-tree invariants after node insertion */ diff --git a/dataflowAPI/src/SymEval.C b/dataflowAPI/src/SymEval.C index 4ff6d74..cd18877 100644 --- a/dataflowAPI/src/SymEval.C +++ b/dataflowAPI/src/SymEval.C @@ -57,6 +57,8 @@ #include "boost/tuple/tuple.hpp" +using std::endl; +using std::map; using namespace Dyninst; using namespace InstructionAPI; using namespace DataflowAPI; @@ -138,7 +140,7 @@ void dfs(Node::Ptr source, std::map<Node::Ptr, int>::iterator ssit = state.find(source); if(ssit == state.end()) boost::tuples::tie(ssit,boost::tuples::ignore) = - state.insert(make_pair(source,1)); + state.insert(std::make_pair(source,1)); else (*ssit).second++; @@ -173,7 +175,7 @@ class ExpandOrder { // remove an element from the next-lowest queue // and return it and its order - pair<SliceNode::Ptr,int> pop_next() + std::pair<SliceNode::Ptr,int> pop_next() { SliceNode::Ptr rn = SliceNode::Ptr(); int ro = -1; @@ -188,7 +190,7 @@ class ExpandOrder { break; } } - return make_pair(rn,ro); + return std::make_pair(rn,ro); } // removes a node from the structure @@ -373,7 +375,7 @@ SymEval::Retval_t SymEval::expand(Dyninst::Graph::Ptr slice, DataflowAPI::Result << " order " << order << endl; if (order != 0) { - cerr << "ERROR: order is non zero: " << order << endl; + std::cerr << "ERROR: order is non zero: " << order << endl; } assert(order == 0); // there are no loops @@ -439,7 +441,7 @@ bool SymEval::expandInsn(const InstructionAPI::Instruction::Ptr insn, SymbolicExpansion exp; exp.expandX86(roseInsn, policy); if (policy.failedTranslate()) { - cerr << "Warning: failed semantic translation of instruction " << insn->format() << endl; + std::cerr << "Warning: failed semantic translation of instruction " << insn->format() << endl; return false; } @@ -453,7 +455,7 @@ bool SymEval::expandInsn(const InstructionAPI::Instruction::Ptr insn, SymbolicExpansion exp; exp.expandX86_64(roseInsn, policy); if (policy.failedTranslate()) { - cerr << "Warning: failed semantic translation of instruction " << insn->format() << endl; + std::cerr << "Warning: failed semantic translation of instruction " << insn->format() << endl; return false; } @@ -468,7 +470,7 @@ bool SymEval::expandInsn(const InstructionAPI::Instruction::Ptr insn, SymbolicExpansion exp; exp.expandPPC(roseInsn, policy); if (policy.failedTranslate()) { - cerr << "Warning: failed semantic translation of instruction " << insn->format() << endl; + std::cerr << "Warning: failed semantic translation of instruction " << insn->format() << endl; return false; } diff --git a/dataflowAPI/src/debug_dataflow.h b/dataflowAPI/src/debug_dataflow.h index 4bc3c07..6e396af 100644 --- a/dataflowAPI/src/debug_dataflow.h +++ b/dataflowAPI/src/debug_dataflow.h @@ -39,11 +39,11 @@ extern int df_debug_convert; extern int df_debug_expand; extern int df_debug_liveness; -#define slicing_cerr if (df_debug_slicing) cerr -#define stackanalysis_cerr if (df_debug_stackanalysis) cerr -#define convert_cerr if (df_debug_convert) cerr -#define expand_cerr if (df_debug_expand) cerr -#define liveness_cerr if (df_debug_liveness) cerr +#define slicing_cerr if (df_debug_slicing) std::cerr +#define stackanalysis_cerr if (df_debug_stackanalysis) std::cerr +#define convert_cerr if (df_debug_convert) std::cerr +#define expand_cerr if (df_debug_expand) std::cerr +#define liveness_cerr if (df_debug_liveness) std::cerr extern int slicing_printf_int(const char *format, ...); extern int stackanalysis_printf_int(const char *format, ...); diff --git a/dataflowAPI/src/stackanalysis.C b/dataflowAPI/src/stackanalysis.C index 2a2eaf7..3057fc1 100644 --- a/dataflowAPI/src/stackanalysis.C +++ b/dataflowAPI/src/stackanalysis.C @@ -51,6 +51,7 @@ #include "parseAPI/h/CFG.h" #include "parseAPI/h/CodeObject.h" +using std::make_pair; using namespace Dyninst; using namespace InstructionAPI; using namespace Dyninst::ParseAPI; @@ -492,7 +493,7 @@ std::string StackAnalysis::TransferFunc::format() const { foundType = true; } if (isAbs()) { - ret << abs << dec; + ret << abs << std::dec; foundType = true; } if (isSIB()) { @@ -525,10 +526,10 @@ std::string StackAnalysis::TransferFunc::format() const { } std::string StackAnalysis::SummaryFunc::format() const { - stringstream ret; + std::stringstream ret; for (TransferSet::const_iterator iter = accumFuncs.begin(); iter != accumFuncs.end(); ++iter) { - ret << iter->second.format() << endl; + ret << iter->second.format() << std::endl; } return ret.str(); } diff --git a/dyninstAPI/h/BPatch_snippet.h b/dyninstAPI/h/BPatch_snippet.h index de41d8f..728d4fb 100644 --- a/dyninstAPI/h/BPatch_snippet.h +++ b/dyninstAPI/h/BPatch_snippet.h @@ -366,7 +366,7 @@ class BPATCH_DLL_EXPORT BPatch_variableExpr : public BPatch_snippet friend class BPatch_image; friend class BPatch_function; - string name; + std::string name; BPatch_addressSpace *appAddSpace; AddressSpace *lladdrSpace; void *address; diff --git a/dyninstAPI/src/StackMod/StackAccess.C b/dyninstAPI/src/StackMod/StackAccess.C index 03db5f3..c4ab629 100644 --- a/dyninstAPI/src/StackMod/StackAccess.C +++ b/dyninstAPI/src/StackMod/StackAccess.C @@ -104,7 +104,7 @@ int getAccessSize(InstructionAPI::Instruction::Ptr insn) if (accessSize == 0) { accessSize = value->size(); } else { - accessSize = min(accessSize, value->size()); + accessSize = std::min(accessSize, value->size()); } } @@ -215,7 +215,7 @@ bool getAccesses(ParseAPI::Function* func, access->format().c_str()); continue; } - accesses->insert(make_pair(curReg, access)); + accesses->insert(std::make_pair(curReg, access)); } } } diff --git a/dyninstAPI/src/parse-cfg.h b/dyninstAPI/src/parse-cfg.h index 22dfba2..3d3a3f5 100644 --- a/dyninstAPI/src/parse-cfg.h +++ b/dyninstAPI/src/parse-cfg.h @@ -230,16 +230,16 @@ class parse_func : public ParseAPI::Function SymtabAPI::Function* getSymtabFunction() const{ return func_; - } + } /*** Function naming ***/ - string symTabName() const { + std::string symTabName() const { return func_->getFirstSymbol()->getMangledName(); } - string prettyName() const { + std::string prettyName() const { return func_->getFirstSymbol()->getPrettyName(); } - string typedName() const { + std::string typedName() const { return func_->getFirstSymbol()->getTypedName(); } SymtabAPI::Aggregate::name_iter symtab_names_begin() const diff --git a/parseAPI/h/CFG.h b/parseAPI/h/CFG.h index 5816d09..be76331 100644 --- a/parseAPI/h/CFG.h +++ b/parseAPI/h/CFG.h @@ -54,6 +54,8 @@ namespace Dyninst { namespace ParseAPI { +using std::vector; + class LoopAnalyzer; class dominatorCFG; class CodeObject; @@ -474,12 +476,12 @@ class PARSER_EXPORT Function : public allocatable, public AnnotatableSparse { typedef boost::iterator_range<bmap_const_iterator> const_blocklist; typedef std::set<Edge*> edgelist; - Function(Address addr, string name, CodeObject * obj, + Function(Address addr, std::string name, CodeObject * obj, CodeRegion * region, InstructionSource * isource); virtual ~Function(); - virtual const string & name() const; + virtual const std::string & name() const; Address addr() const { return _start; } CodeRegion * region() const { return _region; } diff --git a/parseAPI/h/CodeSource.h b/parseAPI/h/CodeSource.h index 7f338be..1448633 100644 --- a/parseAPI/h/CodeSource.h +++ b/parseAPI/h/CodeSource.h @@ -63,7 +63,7 @@ class PARSER_EXPORT CodeRegion : public Dyninst::InstructionSource, public Dynin Optional */ - virtual void names(Address, vector<std::string> &) { return; } + virtual void names(Address, std::vector<std::string> &) { return; } /* Finds the exception handler block for a given address in the region. @@ -220,7 +220,7 @@ class PARSER_EXPORT SymtabCodeRegion : public CodeRegion { SymtabCodeRegion(SymtabAPI::Symtab *, SymtabAPI::Region *); ~SymtabCodeRegion(); - void names(Address, vector<std::string> &); + void names(Address, std::vector<std::string> &); bool findCatchBlock(Address addr, Address & catchStart); /** InstructionSource implementation **/ diff --git a/parseAPI/src/CFGFactory.C b/parseAPI/src/CFGFactory.C index 8ced7cd..d613390 100644 --- a/parseAPI/src/CFGFactory.C +++ b/parseAPI/src/CFGFactory.C @@ -84,7 +84,7 @@ CFGFactory::~CFGFactory() // ParseAPI call... Function * -CFGFactory::_mkfunc(Address addr, FuncSource src, string name, +CFGFactory::_mkfunc(Address addr, FuncSource src, std::string name, CodeObject * obj, CodeRegion * reg, Dyninst::InstructionSource * isrc) { Function * ret = mkfunc(addr,src,name,obj,reg,isrc); @@ -95,7 +95,7 @@ CFGFactory::_mkfunc(Address addr, FuncSource src, string name, // And user-overriden create Function * -CFGFactory::mkfunc(Address addr, FuncSource, string name, +CFGFactory::mkfunc(Address addr, FuncSource, std::string name, CodeObject * obj, CodeRegion * reg, Dyninst::InstructionSource * isrc) { Function * ret = new Function(addr,name,obj,reg,isrc); @@ -127,7 +127,7 @@ CFGFactory::_mksink(CodeObject * obj, CodeRegion *r) { Block * CFGFactory::mksink(CodeObject * obj, CodeRegion *r) { - Block * ret = new Block(obj,r,numeric_limits<Address>::max()); + Block * ret = new Block(obj,r,std::numeric_limits<Address>::max()); return ret; } diff --git a/parseAPI/src/IA_x86.C b/parseAPI/src/IA_x86.C index 16cb09a..199bc45 100644 --- a/parseAPI/src/IA_x86.C +++ b/parseAPI/src/IA_x86.C @@ -742,7 +742,7 @@ bool IA_IAPI::isIATcall(std::string &calleeName) const return false; mal_printf("found IAT call at %lx to %s\n", current, funcAsciiPtr); - calleeName = string(funcAsciiPtr); + calleeName = std::string(funcAsciiPtr); return true; } diff --git a/parseAPI/src/LoopAnalyzer.C b/parseAPI/src/LoopAnalyzer.C index e1a54d9..8cce67e 100644 --- a/parseAPI/src/LoopAnalyzer.C +++ b/parseAPI/src/LoopAnalyzer.C @@ -108,7 +108,7 @@ void LoopAnalyzer::createLoopHierarchy() loop_sort l; std::sort(outerLoops.begin(), outerLoops.end(), l); // Recursively build the loop nesting tree - dfsCreateLoopHierarchy(loopRoot, outerLoops, string("")); + dfsCreateLoopHierarchy(loopRoot, outerLoops, std::string("")); // Enumerate every basic blocks in the functions to find all create // call information for each loop diff --git a/parseAPI/src/ThunkData.h b/parseAPI/src/ThunkData.h index 1e4cd410..14968ab 100644 --- a/parseAPI/src/ThunkData.h +++ b/parseAPI/src/ThunkData.h @@ -16,13 +16,13 @@ struct ThunkInfo { ParseAPI::Block *block; }; -typedef map<Address, ThunkInfo > ThunkData; +typedef std::map<Address, ThunkInfo > ThunkData; struct ReachFact { ThunkData &thunks; - map<ParseAPI::Block*, set<ParseAPI::Block*> > thunk_ins, thunk_outs; + std::map<ParseAPI::Block*, std::set<ParseAPI::Block*> > thunk_ins, thunk_outs; void ReverseDFS(ParseAPI::Block *cur, set<ParseAPI::Block*> &visited); void NaturalDFS(ParseAPI::Block *cur, set<ParseAPI::Block*> &visited); diff --git a/patchAPI/h/PatchCFG.h b/patchAPI/h/PatchCFG.h index 2d8f019..64f3258 100644 --- a/patchAPI/h/PatchCFG.h +++ b/patchAPI/h/PatchCFG.h @@ -197,7 +197,7 @@ class PATCHAPI_EXPORT PatchFunction { PatchFunction(const PatchFunction* parFunc, PatchObject* child); virtual ~PatchFunction(); - const string &name() const { return func_->name(); } + const std::string &name() const { return func_->name(); } Address addr() const { return addr_; } ParseAPI::Function *function() const { return func_; } PatchObject *obj() const { return obj_; } diff --git a/patchAPI/src/AddrSpace.C b/patchAPI/src/AddrSpace.C index a0a68c2..65c3067 100644 --- a/patchAPI/src/AddrSpace.C +++ b/patchAPI/src/AddrSpace.C @@ -98,8 +98,8 @@ AddrSpace::free(PatchObject* /*obj*/, Address /*orig*/) { } std::string AddrSpace::format() const { - stringstream ret; - ret << hex << this << dec << endl; + std::stringstream ret; + ret << std::hex << this << std::dec << std::endl; return ret.str(); } @@ -118,7 +118,7 @@ bool AddrSpace::consistency(const PatchMgr *m) const for (ObjMap::const_iterator iter = obj_map_.begin(); iter != obj_map_.end(); ++iter) { if (!iter->second->consistency(this)) { - cerr << "Error: " << iter->second->format() << " failed consistency!" << endl; + cerr << "Error: " << iter->second->format() << " failed consistency!" << std::endl; return false; } } diff --git a/patchAPI/src/PatchBlock.C b/patchAPI/src/PatchBlock.C index e33cb42..e656817 100644 --- a/patchAPI/src/PatchBlock.C +++ b/patchAPI/src/PatchBlock.C @@ -38,6 +38,9 @@ #include "Point.h" #include <boost/shared_ptr.hpp> +using std::hex; +using std::dec; +using std::endl; using namespace Dyninst; using namespace PatchAPI; using namespace InstructionAPI; @@ -269,7 +272,7 @@ PatchBlock::containsDynamicCall() { std::string PatchBlock::disassemble() const { - stringstream ret; + std::stringstream ret; Insns instances; getInsns(instances); for (Insns::iterator iter = instances.begin(); @@ -288,7 +291,7 @@ PatchBlock::getInsn(Address a) const { std::string PatchBlock::long_format() const { - stringstream ret; + std::stringstream ret; ret << format() << endl; Insns insns; @@ -302,7 +305,7 @@ PatchBlock::long_format() const { std::string PatchBlock::format() const { - stringstream ret; + std::stringstream ret; ret << "B[" << hex << start() << "," << end() << "]" << dec; return ret.str(); diff --git a/patchAPI/src/PatchCallback.C b/patchAPI/src/PatchCallback.C index 80e886b..f8833bd 100644 --- a/patchAPI/src/PatchCallback.C +++ b/patchAPI/src/PatchCallback.C @@ -161,7 +161,7 @@ void PatchCallback::destroy(PatchBlock *b) { void PatchCallback::destroy(PatchEdge *e, PatchObject *o) { if (batching_) { - pair<PatchEdge*, PatchObject*> deadEdge(e,o); + std::pair<PatchEdge*, PatchObject*> deadEdge(e,o); destroyedEdges_.push_back(deadEdge); } else { diff --git a/patchAPI/src/PatchEdge.C b/patchAPI/src/PatchEdge.C index 28e0c2e..d2de5bb 100644 --- a/patchAPI/src/PatchEdge.C +++ b/patchAPI/src/PatchEdge.C @@ -132,7 +132,7 @@ bool EdgePoints::consistency(const PatchEdge *edge, const PatchFunction *func) c } std::string PatchEdge::format() const { - stringstream ret; + std::stringstream ret; ret << "{" << src_->format() << "," diff --git a/patchAPI/src/PatchFunction.C b/patchAPI/src/PatchFunction.C index fdbd884..a45473f 100644 --- a/patchAPI/src/PatchFunction.C +++ b/patchAPI/src/PatchFunction.C @@ -35,6 +35,7 @@ #include "CFG.h" +using std::endl; using namespace Dyninst; using namespace PatchAPI; @@ -609,8 +610,8 @@ bool PatchFunction::consistency() const { for (Blockset::const_iterator iter = all_blocks_.begin(); iter != all_blocks_.end(); ++iter) { if (!(*iter)->consistency()) { CONSIST_FAIL; - cerr << "Error: block ["<< hex << (*iter)->start() << " " - << (*iter)->end() << dec << ") failed consistency check" << endl; + cerr << "Error: block ["<< std::hex << (*iter)->start() << " " + << (*iter)->end() << std::dec << ") failed consistency check" << endl; } bool found = false; for (ParseAPI::Function::blocklist::iterator iter2 = func_->blocks().begin(); diff --git a/patchAPI/src/PatchModifier.C b/patchAPI/src/PatchModifier.C index 52c7eae..c12a70e 100644 --- a/patchAPI/src/PatchModifier.C +++ b/patchAPI/src/PatchModifier.C @@ -75,7 +75,7 @@ bool PatchModifier::redirect(PatchEdge *edge, PatchBlock *target) { assert(src->consistency()); if(oldTrg) { - assert(oldTrg->start() == numeric_limits<Address>::max() || // don't check sink block's consistency + assert(oldTrg->start() == std::numeric_limits<Address>::max() || // don't check sink block's consistency oldTrg->consistency()); } diff --git a/patchAPI/src/PatchObject.C b/patchAPI/src/PatchObject.C index 43f1477..a23e499 100644 --- a/patchAPI/src/PatchObject.C +++ b/patchAPI/src/PatchObject.C @@ -188,7 +188,7 @@ PatchObject::getBlock(ParseAPI::Block* b, bool create) { if (co_ != b->obj()) { cerr << "ERROR: block starting at 0x" << b->start() << " doesn't exist in this object!\n"; - cerr << "This: " << hex << this << " and our code object: " << co_ << " and block is " << b->obj() << dec << endl; + cerr << "This: " << std::hex << this << " and our code object: " << co_ << " and block is " << b->obj() << std::dec << std::endl; assert(0); } BlockMap::iterator iter = blocks_.find(b); @@ -295,13 +295,13 @@ bool PatchObject::splitBlock(PatchBlock * /*orig*/, ParseAPI::Block *second) { std::string PatchObject::format() const { ParseAPI::CodeSource *cs = co()->cs(); ParseAPI::SymtabCodeSource *symtab = dynamic_cast<ParseAPI::SymtabCodeSource *>(cs); - stringstream ret; + std::stringstream ret; if (symtab) { //ret << symtab->getSymtabObject()->name(); } - ret << hex << "(" << this << ")" << dec; + ret << std::hex << "(" << this << ")" << std::dec; return ret.str(); } @@ -312,13 +312,13 @@ bool PatchObject::consistency(const AddrSpace *as) const { for (FuncMap::const_iterator iter = funcs_.begin(); iter != funcs_.end(); ++iter) { if (!iter->second->consistency()) { - cerr << "Error: " << iter->second->name() << " failed consistency!" << endl; + cerr << "Error: " << iter->second->name() << " failed consistency!" << std::endl; return false; } } for (BlockMap::const_iterator iter = blocks_.begin(); iter != blocks_.end(); ++iter) { if (!iter->second->consistency()) { - cerr << "Error: block @ " << hex << iter->second->start() << " failed consistency" << endl; + cerr << "Error: block @ " << std::hex << iter->second->start() << " failed consistency" << std::endl; return false; } } diff --git a/symtabAPI/h/Aggregate.h b/symtabAPI/h/Aggregate.h index 586a927..d65aa9e 100644 --- a/symtabAPI/h/Aggregate.h +++ b/symtabAPI/h/Aggregate.h @@ -87,7 +87,7 @@ class SYMTAB_EXPORT Aggregate //std::vector<std::string> getAllMangledNames(); //std::vector<std::string> getAllPrettyNames(); //std::vector<std::string> getAllTypedNames(); - typedef boost::transform_iterator<std::const_mem_fun_t<string, Symbol>, vector<Symbol*>::const_iterator> name_iter; + typedef boost::transform_iterator<std::const_mem_fun_t<std::string, Symbol>, std::vector<Symbol*>::const_iterator> name_iter; name_iter mangled_names_begin() const; name_iter mangled_names_end() const; name_iter pretty_names_begin() const; diff --git a/symtabAPI/h/Function.h b/symtabAPI/h/Function.h index 607de55..b942e42 100644 --- a/symtabAPI/h/Function.h +++ b/symtabAPI/h/Function.h @@ -189,7 +189,7 @@ class SYMTAB_EXPORT InlinedFunction : public FunctionBase ~InlinedFunction(); virtual Module* getModule() const { return module_; } public: - typedef vector<std::string>::const_iterator name_iter; + typedef std::vector<std::string>::const_iterator name_iter; std::pair<std::string, Dyninst::Offset> getCallsite(); virtual bool removeSymbol(Symbol *sym); virtual bool addMangledName(std::string name, bool isPrimary); -- 2.8.1 _______________________________________________ Dyninst-api mailing list Dyninst-api@cs.wisc.edu https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api