Hi Petr, Since we still have a lot of warnings/errors by default and most of them are duplicated a lot of times for larger object it makes sense to me to default the printing of duplicate messages to something like 16. The attached patch does this. Do you think this is a good idea?
Thanks, Mark
commit 6cc01612be86a1fef6ea098f790c0c1f8d4c68e8 Author: Mark Wielaard <[email protected]> Date: Fri Apr 8 14:25:30 2011 +0200 dwarflint: Default to --dups=16. diff --git a/dwarflint/messages.cc b/dwarflint/messages.cc index a803a50..2c0810e 100644 --- a/dwarflint/messages.cc +++ b/dwarflint/messages.cc @@ -302,7 +302,9 @@ namespace } global_opt<unsigned_option> - dup_threshold_opt ("Threshold for duplicate messages.", + dup_threshold_opt ("Threshold for duplicate messages." + " Defaults to 16." + " Use zero for no limit.", "count", "dups"); namespace @@ -310,7 +312,7 @@ namespace unsigned dup_threshold () { - static unsigned t = dup_threshold_opt.value (); + static unsigned t = dup_threshold_opt.value (16); if (t == 0) t = -1; return t; @@ -369,7 +371,8 @@ message_context::id (void const *key, bool &whether) else if (int status = _m_filter->should_emit (key)) { if (status == -1) - get_stream () << "(threshold reached for the following message)" + get_stream () << "(threshold [--dups=" << dup_threshold () + << "] reached for the following message)" << std::endl; whether = true; return when (true); diff --git a/dwarflint/option.hh b/dwarflint/option.hh index 9dccc2f..5e4eb48 100644 --- a/dwarflint/option.hh +++ b/dwarflint/option.hh @@ -159,6 +159,11 @@ public: return _m_arg; } + arg_type const &value (arg_type arg) + { + return seen () ? _m_arg : arg; + } + error_t parse_opt (char *arg, __attribute__ ((unused)) argp_state *state) { _m_seen = true; diff --git a/dwarflint/tests/run-check_duplicate_DW_tag_variable.sh b/dwarflint/tests/run-check_duplicate_DW_tag_variable.sh index 3a4de1b..36725b7 100755 --- a/dwarflint/tests/run-check_duplicate_DW_tag_variable.sh +++ b/dwarflint/tests/run-check_duplicate_DW_tag_variable.sh @@ -29,7 +29,7 @@ srcdir=$srcdir/tests testfiles crc7.ko.debug -testrun_compare ./dwarflint --check check_duplicate_DW_tag_variable crc7.ko.debug <<EOF +testrun_compare ./dwarflint --dups=0 --check check_duplicate_DW_tag_variable crc7.ko.debug <<EOF warning: .debug_info: DIE 0x40f1: DW_AT_low_pc value not below DW_AT_high_pc. warning: .debug_info: CU 16614: no aranges table is associated with this CU. warning: .debug_info: DIE 0x3d21: Redeclaration of variable 'console_printk', originally seen at DIE 37f3.
_______________________________________________ elfutils-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/elfutils-devel
