struct __suppressed_warning {
struct list_head node;
const char *function;
+ int counter;
};
void __kunit_start_suppress_warning(struct __suppressed_warning *warning);
#define DEFINE_SUPPRESSED_WARNING(func) \
struct __suppressed_warning __kunit_suppress_##func = \
- { .function = __stringify(func) }
+ { .function = __stringify(func), .counter = 0 }
#define KUNIT_START_SUPPRESSED_WARNING(func) \
__kunit_start_suppress_warning(&__kunit_suppress_##func)
#define KUNIT_IS_SUPPRESSED_WARNING(func) \
__kunit_is_suppressed_warning(func)
+#define SUPPRESSED_WARNING_COUNT(func) \
+ (__kunit_suppress_##func.counter)
+
#else /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */
#define DEFINE_SUPPRESSED_WARNING(func)
#define KUNIT_START_SUPPRESSED_WARNING(func)
#define KUNIT_END_SUPPRESSED_WARNING(func)
#define KUNIT_IS_SUPPRESSED_WARNING(func) (false)
+#define SUPPRESSED_WARNING_COUNT(func) (0)
#endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */
#endif /* __ASSEMBLY__ */
return false;
list_for_each_entry(warning, &suppressed_warnings, node) {
- if (!strcmp(function, warning->function))
+ if (!strcmp(function, warning->function)) {
+ warning->counter++;
return true;
+ }
}
return false;
}