[cfe-commits] [PATCH] Implement -Wvla correctly

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Jan 8 07:46:53 PST 2013


On 7 January 2013 18:00, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> Hello,
>
> GCC implements -Wvla as "warn on every VLA" (this is useful to find
> every VLA, for example, if they are forbidden by coding guidelines).
> Currently Clang implements -Wvla as "warn on VLA when it is an
> extension".
>
> The attached patch makes our behavior match GCC.  The existing vla
> extwarn is moved under -Wvla-extension and is still included into
> -Wgnu.
>
> -Wvla is disabled by default, so I don't think that this change will
> cause much fallout.

Do you want this to warn (in C) for

void test(int n, int v[n]) {
}

What about just declaring test? Please add a test for both.

In c++, do you expect an warning in

template<typename T>
void test(int n) {
  int v[n];
}

Even when the template is never instantiated? Please add a test one
way or the other.

> This fixes PR5953.
>
> Dmitri
>

Cheers,
Rafael



More information about the cfe-commits mailing list