bool
checkrules::should_check (checkstack const &stack) const
{
-#if 0
- std::cout << "---\nstack" << std::endl;
- for (checkstack::const_iterator jt = stack.begin ();
- jt != stack.end (); ++jt)
- std::cout << (*jt)->name << std::flush << " ";
- std::cout << std::endl;
-#endif
-
// We always allow scheduling hidden checks. Those are service
// routines that the user doesn't even see it the list of checks.
assert (!stack.empty ());
namespace
{
template<class T> struct do_check {
- static void check (checkstack &stack, dwarflint &lint) {
- lint.check<T> (stack);
+ static bool check (checkstack &stack, dwarflint &lint) {
+ return lint.toplev_check<T> (stack);
}
};
#define STUBBED_CHECK(NAME) \
struct check_debug_##NAME {}; \
template<> struct do_check<check_debug_##NAME> { \
- static void check (__attribute__ ((unused)) checkstack &stack, \
- __attribute__ ((unused)) dwarflint &lint) {} \
+ static bool check (__attribute__ ((unused)) checkstack &stack, \
+ __attribute__ ((unused)) dwarflint &lint) \
+ { \
+ return true; \
+ } \
}
STUBBED_CHECK(str);
STUBBED_CHECK(mac);
// Then check all the debug sections that are there. For each
// existing section request that the check passes. Re-requesting
// already-passed checks is OK, the scheduler caches it.
+ bool passed = true;
+
#define SEC(NAME) \
section<sec_##NAME> *NAME = \
lint.toplev_check<section<sec_##NAME> > (stack); \
if (NAME != NULL) \
- do_check<check_debug_##NAME>::check (stack, lint);
+ if (!do_check<check_debug_##NAME>::check (stack, lint)) \
+ passed = false;
+
DEBUGINFO_SECTIONS;
#undef SEC
lint.check<check_debug_info_refs> (stack);
+
+ if (!passed)
+ throw check_base::failed ();
}
warning: .debug_aranges: [0x20, 0x30): unnecessary padding with zero bytes.
warning: .debug_aranges: addresses [0x400474, 0x400481) are covered with CUs, but not with aranges.
EOF
+
+testrun_compare ./dwarflint --check=check_debug_aranges --strict aranges_terminate_early <<EOF
+warning: .debug_aranges: [0x20, 0x30): unnecessary padding with zero bytes.
+warning: .debug_aranges: addresses [0x400474, 0x400481) are covered with CUs, but not with aranges.
+EOF