diff options
author | Petr Machata <pmachata@redhat.com> | 2011-03-28 20:19:36 +0200 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2011-03-28 20:19:36 +0200 |
commit | eb51470a4485373fc8e971f66c0c712e8f71e940 (patch) | |
tree | a50cb026dd5c29ec47bf46d72468eabde68e18da | |
parent | 6eecad70d2ae747aa04cca78ea2334ed3fb7986d (diff) | |
download | elfutils-eb51470a4485373fc8e971f66c0c712e8f71e940.tar.gz |
dwarflint: Drop the "cat" function, use operator| instead
-rw-r--r-- | dwarflint/check_debug_abbrev.cc | 5 | ||||
-rw-r--r-- | dwarflint/check_debug_info.cc | 28 | ||||
-rw-r--r-- | dwarflint/check_debug_line.cc | 20 | ||||
-rw-r--r-- | dwarflint/check_debug_loc_range.cc | 4 | ||||
-rw-r--r-- | dwarflint/check_dups_abstract_origin.cc | 3 | ||||
-rw-r--r-- | dwarflint/check_expected_trees.cc | 8 | ||||
-rw-r--r-- | dwarflint/check_matching_ranges.cc | 4 | ||||
-rw-r--r-- | dwarflint/check_range_out_of_scope.cc | 2 | ||||
-rw-r--r-- | dwarflint/check_self_referential_die.cc | 5 | ||||
-rw-r--r-- | dwarflint/messages.cc | 4 | ||||
-rw-r--r-- | dwarflint/messages.hh | 9 | ||||
-rw-r--r-- | dwarflint/sections.cc | 2 |
12 files changed, 40 insertions, 54 deletions
diff --git a/dwarflint/check_debug_abbrev.cc b/dwarflint/check_debug_abbrev.cc index c8038c6d..591c8d96 100644 --- a/dwarflint/check_debug_abbrev.cc +++ b/dwarflint/check_debug_abbrev.cc @@ -135,7 +135,7 @@ namespace if (ret) { where wh = WHERE (sec_abbrev, NULL); - wr_message (wh, cat (mc_abbrevs, mc_impact_1, mc_acc_bloat)) + wr_message (wh, mc_abbrevs | mc_impact_1 | mc_acc_bloat) << "no abbreviations." << std::endl; } return ret; @@ -446,8 +446,7 @@ namespace if (attrib_name == DW_AT_sibling) { if (!cur->has_children) - wr_message (where, - cat (mc_die_rel, mc_acc_bloat, mc_impact_1)) + wr_message (where, mc_die_rel | mc_acc_bloat | mc_impact_1) << "superfluous DW_AT_sibling attribute at childless abbrev." << std::endl; } diff --git a/dwarflint/check_debug_info.cc b/dwarflint/check_debug_info.cc index dd089853..453d832e 100644 --- a/dwarflint/check_debug_info.cc +++ b/dwarflint/check_debug_info.cc @@ -157,8 +157,7 @@ namespace reference is valid, which it is. But warn about this anyway, perhaps local reference could be formed on smaller number of bytes. */ - wr_message (ref->who, - cat (mc_impact_2, mc_acc_suboptimal, mc_die_rel)) + wr_message (ref->who, mc_impact_2 | mc_acc_suboptimal | mc_die_rel) << "local reference to " << pri::DIE (ref->addr) << " formed as global." << std::endl; } @@ -194,7 +193,7 @@ namespace if (!read_ctx_need_data (&ctx, 4) && read_check_zero_padding (&ctx, &off_start, &off_end)) { - wr_message_padding_0 (cat (mc_info, mc_header), &where, + wr_message_padding_0 (mc_info | mc_header, &where, off_start, off_end); break; } @@ -213,7 +212,7 @@ namespace if (size32 == 0 && read_check_zero_padding (&ctx, &off_start, &off_end)) { - wr_message_padding_0 (cat (mc_info, mc_header), &where, + wr_message_padding_0 (mc_info | mc_header, &where, off_start, off_end); break; } @@ -275,7 +274,7 @@ namespace // next time we pass by this } else if (file->ehdr.e_type == ET_REL) - wr_message (head.where, cat (mc_impact_2, mc_info, mc_reloc)) + wr_message (head.where, mc_impact_2 | mc_info | mc_reloc) << pri::lacks_relocation ("abbrev table offset") << std::endl; /* Address size. */ @@ -477,7 +476,7 @@ namespace check_rangeptr (uint64_t value, struct value_check_cb_ctx const *ctx) { if ((value % ctx->cu->head->address_size) != 0) - wr_message (*ctx->where, cat (mc_ranges, mc_impact_2)) + wr_message (*ctx->where, mc_ranges | mc_impact_2) << "rangeptr value " << pri::hex (value) << " not aligned to CU address size." << std::endl; *ctx->need_rangesp = true; @@ -613,8 +612,7 @@ namespace reason we can't simply check this when loading abbrevs. */ DEF_PREV_WHERE; - wr_message (prev_where, cat (mc_die_rel, mc_acc_suboptimal, - mc_impact_4)) + wr_message (prev_where, mc_die_rel | mc_acc_suboptimal | mc_impact_4) << "This DIE had children, but no DW_AT_sibling attribute." << std::endl; } @@ -880,8 +878,8 @@ namespace &where, skip_mismatched))) { if (relocate == rel_no) - wr_message (where, cat (mc_impact_4, mc_die_other, - mc_reloc, extra_mc)) + wr_message (where, (mc_impact_4 | mc_die_other + | mc_reloc | extra_mc)) << "unexpected relocation of " << elfutils::dwarf::forms::name (form_name) << '.' << std::endl; @@ -904,8 +902,8 @@ namespace && (relocate == rel_require || (relocate == rel_nonzero && value != 0))) - wr_message (where, cat (mc_impact_2, mc_die_other, - mc_reloc, extra_mc)) + wr_message (where, (mc_impact_2 | mc_die_other + | mc_reloc | extra_mc)) << pri::lacks_relocation (elfutils::dwarf::forms::name (form_name)) << std::endl; @@ -1159,7 +1157,7 @@ check_debug_info::check_debug_info (checkstack &stack, dwarflint &lint) /* Did we read up everything? */ { where wh = WHERE (sec_info, NULL); - wr_message (cat (mc_die_other, mc_impact_4), &wh, + wr_message (mc_die_other | mc_impact_4, &wh, ": CU lengths don't exactly match Elf_Data contents."); } else @@ -1177,7 +1175,7 @@ check_debug_info::check_debug_info (checkstack &stack, dwarflint &lint) for (size_t i = 0; i < it->second.size; ++i) if (!it->second.abbr[i].used) wr_message (it->second.abbr[i].where, - cat (mc_impact_3, mc_acc_bloat, mc_abbrevs)) + mc_impact_3 | mc_acc_bloat | mc_abbrevs) << "abbreviation is never used." << std::endl; } @@ -1289,7 +1287,7 @@ check_debug_info_refs::check_debug_info_refs (checkstack &stack, if (_m_aranges != NULL && !it->has_arange) wr_message (it->head->where, - cat (mc_impact_3, mc_acc_suboptimal, mc_aranges, mc_info)) + mc_impact_3 | mc_acc_suboptimal | mc_aranges | mc_info) << "no aranges table is associated with this CU." << std::endl; } } diff --git a/dwarflint/check_debug_line.cc b/dwarflint/check_debug_line.cc index 77ee6ebe..b9d450f7 100644 --- a/dwarflint/check_debug_line.cc +++ b/dwarflint/check_debug_line.cc @@ -103,7 +103,7 @@ namespace return false; if (*name == '/' && *ptr != 0) - wr_message (*where, cat (mc_impact_2, mc_line, mc_header)) + wr_message (*where, mc_impact_2 | mc_line | mc_header) << "file #" << nfile << " has absolute pathname, but refers to directory != 0." << std::endl; @@ -111,7 +111,7 @@ namespace if (*ptr > include_directories.size ()) /* Not >=, dirs are indexed from 1. */ { - wr_message (*where, cat (mc_impact_4, mc_line, mc_header)) + wr_message (*where, mc_impact_4 | mc_line | mc_header) << "file #" << nfile << " refers to directory #" << *ptr << ", which wasn't defined." << std::endl; @@ -228,7 +228,7 @@ check_debug_line::check_debug_line (checkstack &stack, dwarflint &lint) "true." [But give a notice if it's not 0 or 1.] */ if (default_is_stmt != 0 && default_is_stmt != 1) - wr_message (where, cat (mc_line, mc_impact_2, mc_header)) + wr_message (where, mc_line | mc_impact_2 | mc_header) << "default_is_stmt should be 0 or 1, not " << default_is_stmt << '.' << std::endl; @@ -369,10 +369,10 @@ check_debug_line::check_debug_line (checkstack &stack, dwarflint &lint) struct where wh = WHERE (sec_line, NULL); uint64_t off_start, off_end; if (read_check_zero_padding (&sub_ctx, &off_start, &off_end)) - wr_message_padding_0 (cat (mc_line, mc_header), &wh, + wr_message_padding_0 (mc_line | mc_header, &wh, off_start, off_end); else - wr_message_padding_n0 (cat (mc_line, mc_header), &wh, + wr_message_padding_n0 (mc_line | mc_header, &wh, off_start, program_start - sub_ctx.begin); sub_ctx.ptr = program_start; } @@ -489,7 +489,7 @@ check_debug_line::check_debug_line (checkstack &stack, dwarflint &lint) #undef ONE_KNOWN_DW_LNE default: /* No we don't, emit a warning. */ - wr_message (where, cat (mc_impact_2, mc_line)) + wr_message (where, mc_impact_2 | mc_line) << "unknown extended opcode #" << extended << '.' << std::endl; }; @@ -577,7 +577,7 @@ check_debug_line::check_debug_line (checkstack &stack, dwarflint &lint) default: if (opcode < opcode_base) - wr_message (where, cat (mc_impact_2, mc_line)) + wr_message (where, mc_impact_2 | mc_line) << "unknown standard opcode #" << opcode << '.' << std::endl; }; @@ -612,7 +612,7 @@ check_debug_line::check_debug_line (checkstack &stack, dwarflint &lint) for (size_t i = 0; i < include_directories.size (); ++i) if (!include_directories[i].used) wr_message (where, - cat (mc_impact_3, mc_acc_bloat, mc_line, mc_header)) + mc_impact_3 | mc_acc_bloat | mc_line | mc_header) << "the include #" << i + 1 << " `" << include_directories[i].name << "' is not used." << std::endl; @@ -626,14 +626,14 @@ check_debug_line::check_debug_line (checkstack &stack, dwarflint &lint) for (size_t i = 0; i < files.size (); ++i) if (!files[i].used) wr_message (where, - cat (mc_impact_3, mc_acc_bloat, mc_line, mc_header)) + mc_impact_3 | mc_acc_bloat | mc_line | mc_header) << "the file #" << i + 1 << " `" << files[i].name << "' is not used." << std::endl; else useful = true; if (!seen_opcode && !useful) - wr_message (where, cat (mc_line, mc_acc_bloat, mc_impact_3)) + wr_message (where, mc_line | mc_acc_bloat | mc_impact_3) << "empty line number program and no references from .debug_info." << std::endl; } diff --git a/dwarflint/check_debug_loc_range.cc b/dwarflint/check_debug_loc_range.cc index 751d54f1..cdd69606 100644 --- a/dwarflint/check_debug_loc_range.cc +++ b/dwarflint/check_debug_loc_range.cc @@ -890,7 +890,7 @@ check_location_expression (dwarf_version const *ver, int16_t skip = (uint16_t)value1; if (skip == 0) - wr_message (where, cat (mc_loc, mc_acc_bloat, mc_impact_3)) + wr_message (where, mc_loc | mc_acc_bloat | mc_impact_3) << elfutils::dwarf::ops::name (opcode) << " with skip 0." << std::endl; else if (skip > 0 && !read_ctx_need_data (&ctx, (size_t)skip)) @@ -927,7 +927,7 @@ check_location_expression (dwarf_version const *ver, || opcode == DW_OP_deref_size || opcode == DW_OP_plus_uconst) && (value1 > (uint64_t)(uint32_t)-1)) - wr_message (where, cat (mc_loc, mc_acc_bloat, mc_impact_3)) + wr_message (where, mc_loc | mc_acc_bloat | mc_impact_3) << elfutils::dwarf::ops::name (opcode) << " with operand " << pri::hex (value1) << " on a 32-bit machine." << std::endl; diff --git a/dwarflint/check_dups_abstract_origin.cc b/dwarflint/check_dups_abstract_origin.cc index 9bcef17b..3142ba1e 100644 --- a/dwarflint/check_dups_abstract_origin.cc +++ b/dwarflint/check_dups_abstract_origin.cc @@ -73,8 +73,7 @@ namespace at = referree.attributes ().begin (); at != referree.attributes ().end (); ++at) if ((at2 = m.find ((*at).first)) != m.end ()) - wr_message (to_where (die), - cat (mc_impact_3, mc_acc_bloat, mc_die_rel)) + wr_message (to_where (die), mc_impact_3 | mc_acc_bloat | mc_die_rel) << "Attribute " << dwarf::attributes::name (at2->first) << " is duplicated at " << dwarf::attributes::name (attr.first) << " (" << pri::ref (referree) << ")" diff --git a/dwarflint/check_expected_trees.cc b/dwarflint/check_expected_trees.cc index f3eaae10..ab91a712 100644 --- a/dwarflint/check_expected_trees.cc +++ b/dwarflint/check_expected_trees.cc @@ -138,7 +138,7 @@ check_expected_trees::check_expected_trees (checkstack &stack, dwarflint &lint) case opt_expected: if (what == NULL) what = " should contain attribute "; - wr_message (where, cat (mc_impact_2, mc_info)) + wr_message (where, mc_impact_2 | mc_info) << elfutils::dwarf::tags::name (parent_tag) << what << elfutils::dwarf::attributes::name (jt->first) << '.' << std::endl; @@ -161,7 +161,7 @@ check_expected_trees::check_expected_trees (checkstack &stack, dwarflint &lint) expected_set::expectation_map::const_iterator kt = expect.find (name); if (kt == expect.end ()) - wr_message (where, cat (mc_impact_3, mc_info)) + wr_message (where, mc_impact_3 | mc_info) << ": DIE \"" << dwarf::tags::name (parent_tag) << "\" has attribute \"" << dwarf::attributes::name (name) << "\", which is not expected." << std::endl; @@ -171,7 +171,7 @@ check_expected_trees::check_expected_trees (checkstack &stack, dwarflint &lint) unsigned exp_vs = expected_value_space (name, parent_tag); dwarf::value_space vs = (*jt).second.what_space (); if ((exp_vs & (1U << vs)) == 0) - wr_message (where, cat (mc_impact_3, mc_info)) + wr_message (where, mc_impact_3 | mc_info) << ": in DIE \"" << dwarf::tags::name (parent_tag) << "\", attribute \"" << dwarf::attributes::name (name) << "\" has value of unexpected type \"" << vs @@ -180,7 +180,7 @@ check_expected_trees::check_expected_trees (checkstack &stack, dwarflint &lint) // XXX more specific class when <dwarf> has it catch (...) { - wr_message (where, cat (mc_impact_4, mc_info, mc_error)) + wr_message (where, mc_impact_4 | mc_info | mc_error) << ": in DIE \"" << dwarf::tags::name (parent_tag) << "\", couldn't obtain type of attribute \"" << dwarf::attributes::name (name) << "\"." diff --git a/dwarflint/check_matching_ranges.cc b/dwarflint/check_matching_ranges.cc index f9c05962..af46ffff 100644 --- a/dwarflint/check_matching_ranges.cc +++ b/dwarflint/check_matching_ranges.cc @@ -94,7 +94,7 @@ check_matching_ranges::check_matching_ranges (checkstack &stack, for (range_vec::iterator it = missing.begin (); it != missing.end (); ++it) - wr_message (cat (mc_ranges, mc_aranges, mc_impact_3), &where_r, + wr_message (mc_ranges | mc_aranges | mc_impact_3, &where_r, ": missing range %s, present in .debug_aranges.\n", range_fmt (buf, sizeof buf, it->first, it->second)); @@ -105,7 +105,7 @@ check_matching_ranges::check_matching_ranges (checkstack &stack, for (range_vec::iterator it = missing.begin (); it != missing.end (); ++it) - wr_message (cat (mc_ranges, mc_aranges, mc_impact_3), &where_ar, + wr_message (mc_ranges | mc_aranges | mc_impact_3, &where_ar, ": missing range %s, present in .debug_ranges.\n", range_fmt (buf, sizeof buf, it->first, it->second)); } diff --git a/dwarflint/check_range_out_of_scope.cc b/dwarflint/check_range_out_of_scope.cc index 05d914a9..016cb38a 100644 --- a/dwarflint/check_range_out_of_scope.cc +++ b/dwarflint/check_range_out_of_scope.cc @@ -137,7 +137,7 @@ check_range_out_of_scope::recursively_validate if (high_pc != ::noaddr) { if (my_ranges.size () != 0) - wr_message (wh, cat (mc_impact_4, mc_info, mc_error)) + wr_message (wh, mc_impact_4 | mc_info | mc_error) << "both low_pc/high_pc pair and ranges present." << std::endl; else diff --git a/dwarflint/check_self_referential_die.cc b/dwarflint/check_self_referential_die.cc index 1f1dfe8f..196193b6 100644 --- a/dwarflint/check_self_referential_die.cc +++ b/dwarflint/check_self_referential_die.cc @@ -71,9 +71,8 @@ namespace { dwarf::debug_info_entry ref = *val.reference (); if (ref.identity () == die.identity ()) - wr_message (to_where (die), cat (mc_impact_3, - mc_acc_suboptimal, - mc_die_rel)) + wr_message (to_where (die), + mc_impact_3 | mc_acc_suboptimal | mc_die_rel) << "attribute " << dwarf::attributes::name ((*at).first) << " references DIE itself." << std::endl; } diff --git a/dwarflint/messages.cc b/dwarflint/messages.cc index 28b8d20c..b8e8f768 100644 --- a/dwarflint/messages.cc +++ b/dwarflint/messages.cc @@ -137,8 +137,8 @@ message_criteria::operator &= (message_term const &term) for (size_t i = 0; i < size (); ) { message_term &t = at (i); - t.positive = cat (t.positive, term.positive); - t.negative = cat (t.negative, term.negative); + t.positive = t.positive | term.positive; + t.negative = t.negative | term.negative; if ((t.positive & t.negative) != 0) /* A ^ ~A -> drop the term. */ erase (begin () + i); diff --git a/dwarflint/messages.hh b/dwarflint/messages.hh index 7809fb9c..49dbd925 100644 --- a/dwarflint/messages.hh +++ b/dwarflint/messages.hh @@ -153,15 +153,6 @@ extern struct message_criteria warning_criteria; /* Accepted (warning) messages, that are turned into errors. */ extern struct message_criteria error_criteria; -inline message_category -cat (message_category c1, - message_category c2, - message_category c3 = mc_none, - message_category c4 = mc_none) -{ - return c1 | c2 | c3 | c4; -} - std::ostream &wr_warning (where const &wh); std::ostream &wr_warning (); std::ostream &wr_error (where const &wh); diff --git a/dwarflint/sections.cc b/dwarflint/sections.cc index a9b2f0ce..f9a64b08 100644 --- a/dwarflint/sections.cc +++ b/dwarflint/sections.cc @@ -397,7 +397,7 @@ namespace if (secentry *str = secinfo.get (".debug_str")) if (str->reldata != NULL) - wr_message (WHERE (sec_str, NULL), cat (mc_impact_2, mc_elf)) + wr_message (WHERE (sec_str, NULL), mc_impact_2 | mc_elf) << "there's a relocation section associated with this section." << std::endl; } |