That the size is information is used more for checking is generally ongoing work. Inside a function it can be propagated by the compiler.
The old GCC extension can also be hidden behind a macro, so this is backwards compatible:
void foo(HIDE(int x;) char buf[HIDE(x)], int x);