From bc582f782b720245f1a4aed93fadbb80d0dd04db Mon Sep 17 00:00:00 2001 From: "mark@chromium.org" Date: Tue, 11 Oct 2011 17:59:03 +0000 Subject: Remove "using namespace std" from dwarf2reader.h. Using-directives are forbidden by the style guide, and are bad practice in headers even under style rules that tolerate this construct. This fixes warnings such as: In file included from dwarf2reader.cc:34: dwarf2reader.h:53:17: warning: using namespace directive in global context in header [-Wheader-hygiene] Review URL: http://breakpad.appspot.com/312002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@862 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/dwarf/dwarf2reader.cc | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/common/dwarf/dwarf2reader.cc') diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc index 63d1ffb7..b927b3fe 100644 --- a/src/common/dwarf/dwarf2reader.cc +++ b/src/common/dwarf/dwarf2reader.cc @@ -74,7 +74,7 @@ void CompilationUnit::ReadAbbrevs() { iter = sections_.find("__debug_abbrev"); assert(iter != sections_.end()); - abbrevs_ = new vector; + abbrevs_ = new std::vector; abbrevs_->resize(1); // The only way to check whether we are reading over the end of the @@ -121,7 +121,7 @@ void CompilationUnit::ReadAbbrevs() { const enum DwarfAttribute name = static_cast(nametemp); const enum DwarfForm form = static_cast(formtemp); - abbrev.attributes.push_back(make_pair(name, form)); + abbrev.attributes.push_back(std::make_pair(name, form)); } assert(abbrev.number == abbrevs_->size()); abbrevs_->push_back(abbrev); @@ -493,7 +493,7 @@ void CompilationUnit::ProcessDIEs() { else lengthstart += 4; - stack die_stack; + std::stack die_stack; while (dieptr < (lengthstart + header_.length)) { // We give the user the absolute offset from the beginning of @@ -583,7 +583,7 @@ void LineInfo::ReadHeader() { header_.opcode_base = reader_->ReadOneByte(lineptr); lineptr += 1; - header_.std_opcode_lengths = new vector; + header_.std_opcode_lengths = new std::vector; header_.std_opcode_lengths->resize(header_.opcode_base + 1); (*header_.std_opcode_lengths)[0] = 0; for (int i = 1; i < header_.opcode_base; i++) { @@ -1024,7 +1024,7 @@ class CallFrameInfo::RegisterRule: public CallFrameInfo::Rule { // Rule: EXPRESSION evaluates to the address at which the register is saved. class CallFrameInfo::ExpressionRule: public CallFrameInfo::Rule { public: - explicit ExpressionRule(const string &expression) + explicit ExpressionRule(const std::string &expression) : expression_(expression) { } ~ExpressionRule() { } bool Handle(Handler *handler, uint64 address, int reg) const { @@ -1038,13 +1038,13 @@ class CallFrameInfo::ExpressionRule: public CallFrameInfo::Rule { } Rule *Copy() const { return new ExpressionRule(*this); } private: - string expression_; + std::string expression_; }; // Rule: EXPRESSION evaluates to the address at which the register is saved. class CallFrameInfo::ValExpressionRule: public CallFrameInfo::Rule { public: - explicit ValExpressionRule(const string &expression) + explicit ValExpressionRule(const std::string &expression) : expression_(expression) { } ~ValExpressionRule() { } bool Handle(Handler *handler, uint64 address, int reg) const { @@ -1059,7 +1059,7 @@ class CallFrameInfo::ValExpressionRule: public CallFrameInfo::Rule { } Rule *Copy() const { return new ValExpressionRule(*this); } private: - string expression_; + std::string expression_; }; // A map from register numbers to rules. @@ -1096,7 +1096,7 @@ class CallFrameInfo::RuleMap { private: // A map from register numbers to Rules. - typedef map RuleByNumber; + typedef std::map RuleByNumber; // Remove all register rules and clear cfa_rule_. void Clear(); @@ -1240,7 +1240,7 @@ class CallFrameInfo::State { unsigned register_number; // A register number. uint64 offset; // An offset or address. long signed_offset; // A signed offset. - string expression; // A DWARF expression. + std::string expression; // A DWARF expression. }; // Parse CFI instruction operands from STATE's instruction stream as @@ -1341,7 +1341,7 @@ class CallFrameInfo::State { // A stack of saved states, for DW_CFA_remember_state and // DW_CFA_restore_state. - stack saved_rules_; + std::stack saved_rules_; }; bool CallFrameInfo::State::InterpretCIE(const CIE &cie) { @@ -1427,7 +1427,7 @@ bool CallFrameInfo::State::ParseOperands(const char *format, if (len > bytes_left || expression_length > bytes_left - len) return ReportIncomplete(); cursor_ += len; - operands->expression = string(cursor_, expression_length); + operands->expression = std::string(cursor_, expression_length); cursor_ += expression_length; break; } @@ -1898,7 +1898,8 @@ bool CallFrameInfo::ReadCIEFields(CIE *cie) { memchr(augmentation_start, '\0', cie->end - augmentation_start); if (! augmentation_end) return ReportIncomplete(cie); cursor = static_cast(augmentation_end); - cie->augmentation = string(augmentation_start, cursor - augmentation_start); + cie->augmentation = std::string(augmentation_start, + cursor - augmentation_start); // Skip the terminating '\0'. cursor++; @@ -2285,7 +2286,7 @@ void CallFrameInfo::Reporter::UnrecognizedVersion(uint64 offset, int version) { } void CallFrameInfo::Reporter::UnrecognizedAugmentation(uint64 offset, - const string &aug) { + const std::string &aug) { fprintf(stderr, "%s: CFI frame description entry at offset 0x%llx in '%s':" " CIE specifies unrecognized augmentation: '%s'\n", -- cgit v1.2.1