[PATCH] enable -Wformat-length for dynamically allocated buffers (pr 78245)

Martin Sebor msebor@gmail.com
Wed Nov 30 03:23:00 GMT 2016


>>> That said, I defer to you on how to proceed here.  I'm prepared
>>> to do the work(*) but I do worry about jeopardizing the chances
>>> of this patch and the others making it into 7.0.
>> So would it make sense to just init/fini the b_o_s framework in your
>> pass and for builtin expansion?
>
> I think that should work for the sprintf checking.  Let me test it.
> We can deal with the memxxx and strxxx patch (53562) independently
> if you prefer.

Attached is a modified patch that calls {init,fini}_object_sizes()
from the gimple-ssa-sprintf pass instead.

While this works fine, I do like the approach of making the calls
in a single function better because it makes for a more robust API.
Decoupling the init/fini calls from the compute_object_size()
function that depends on them having been made makes the API easier
to accidentally misuse by calling one while forgetting to call one
or both of the other two.

Martin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-78245.diff
Type: text/x-patch
Size: 10307 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161130/f47c9cfd/attachment.bin>


More information about the Gcc-patches mailing list