aaron.ballman added a comment.
In D132952#3773469 <https://reviews.llvm.org/D132952#3773469>, @inclyc wrote:
>> Yeah, that's a different way of delineating than I was thinking originally
>> and it's worth more thought. I was thinking the separation would be "this is
>> a VLA" (for people who want to avoid all VLA stack allocations due to the
>> security concerns) and "this is a portability concern" (for people who want
>> to port to older language standards, C++, other compilers).
>
> I think it is a good idea to separate `-Wvla` into
> `-Wvla-portability`(warnings on portability) and `-Wvla-stack` (warnings on
> stack allocations, security issue). Report `-Wvla-portability` if compilers
> implementations in practice don't support any `vla` syntax especially in C89
> mode and report `-Wvla-stack` if it causes stack allocations.
This is largely the same conclusion I think I've come to as well. Add two new
warning groups (we can bikeshed the names later): `-Wvla-portability` and
`-Wvla-stack-allocation` grouped under the existing `-Wvla`. The behavior of
`-Wvla` won't change, but users can opt into the kind of specific diagnostic
they want. `void func(int n, int array[n]);` would trigger `-Wvla-portability`
but not `-Wvla-stack-allocation`, and `void func(int n) { int array[n]; }`
would trigger both diagnostics (though we could debate having it skip the
`-Wvla-portability` warning whenever giving any other "you're using a VLA" kind
of warning). @efriedma are you on board with that plan as well?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132952/new/
https://reviews.llvm.org/D132952
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits