Compiling unity unit tests with `-Wpedantic` fails

After upgrading to platform = espressif32@6.12.0 compilation of Unit Tests fails with

In file included from .pio/libdeps/gpt_rev2/Unity/src/unity_internals.h:308,
from .pio/libdeps/gpt_rev2/Unity/src/unity.h:21,
from test/test_on_board/src/some_tests.cpp:1:
/home/greg/.platformio/packages/framework-espidf/components/newlib/platform_include/stdio.h:10:2: error: #include_next is a GCC extension [-Werror]
10 | #include_next <stdio.h>
| ^~~~~~~~~~~~

due to the pedantic flag, seems like the platformio is not using system include directive for including unity…
Is there a way to either disable wpedantic only for unit tests or some other solution?

I’m pretty sure you can write a small extra_script that strips out -pedantic out of env.["CFLAGS"] in unit test mode, which you can e.g. detect with