Skip to content

Commit f52f3d8

Browse files
committed
tests: kernel: exception: Disable infinite recursion warning
This commit disables the infinite recursion warning (`-Winfinite-recursion`), which may be reported by the GCC 12 and above, for the `stack_smasher` function because that is the intended behaviour. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
1 parent d75f8c8 commit f52f3d8

File tree

1 file changed

+11
-0
lines changed
  • tests/kernel/fatal/exception/src

1 file changed

+11
-0
lines changed

tests/kernel/fatal/exception/src/main.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,22 @@ __no_optimization void blow_up_stack(void)
181181
#else
182182
/* stack sentinel doesn't catch it in time before it trashes the entire kernel
183183
*/
184+
185+
#if defined(__GNUC__)
186+
#pragma GCC diagnostic push
187+
#pragma GCC diagnostic ignored "-Wpragmas"
188+
#pragma GCC diagnostic ignored "-Winfinite-recursion"
189+
#endif
190+
184191
__no_optimization int stack_smasher(int val)
185192
{
186193
return stack_smasher(val * 2) + stack_smasher(val * 3);
187194
}
188195

196+
#if defined(__GNUC__)
197+
#pragma GCC diagnostic pop
198+
#endif
199+
189200
void blow_up_stack(void)
190201
{
191202
expected_reason = K_ERR_STACK_CHK_FAIL;

0 commit comments

Comments
 (0)