util: silence out-of-bounds read warning

gcc -fanalyze complains because it doesn't know the __stop section is
always greater than the __start section so it complains that we're
eventually reading past our __start section. Let's silence that with a
simple check.
This commit is contained in:
Peter Hutterer 2024-09-11 11:15:31 +10:00
parent ec031bc4bf
commit 22c94fd916

View file

@ -52,7 +52,7 @@
*/
#define foreach_test(t_) \
for (const struct test_function *t_ = &__start_test_functions_section; \
t_ < &__stop_test_functions_section; \
t_ < &__stop_test_functions_section && t < &__start_test_functions_section; \
t_++)
typedef MunitResult (*munit_test_func_t)(const MunitParameter params[], void *user_data);