On 9/30/19 3:34 PM, Joseph Myers wrote:
On Sun, 29 Sep 2019, Martin Sebor wrote:
PR 83859 asks to expose the same checking that GCC does natively for
built-in calls via a function attribute that associates a pointer
argument with the size argument, such as:
I'll also note that, as mentioned in that bug (but more specifically
covered by the separate bug 50584) it would make sense to have similar
warnings with [static] parameter array declarators. And that the C2x
charter includes a principle that new interfaces should have the array
size before the array parameter to allow parameters to be declared using
VLA syntax like that, so it's plausible the [static] case will be useful
for more functions in future (although it's up to library implementations
exactly what form they use in their headers, given they have other
considerations such as C++ compatibility).
Hopefully the infrastructure in this patch will facilitate future support
for such diagnostics in the [static] case.
Thanks for the reminder! I will make sure the infrastructure makes
the VLA checking possible, even if it's not actually implemented for
GCC 10.
Martin