On 01/22/2017 04:53 PM, Martin Sebor wrote:
The attached patch is the last of the refactoring/restructuring
series. It consists of the following changes:
1) Introduce a single global variable, warn_level, that the pass
uses to test the level of the warning that applies to the function
currently being processed (i.e., either -Wformat-overflow or
-Wformat-truncation).
2) Slightly adjust the format_integer function in preparation for
the upcoming substantive changes.
3) Factor code responsible for issuing per-directive warnings out
of format_directive and into a function of its own, maybe_warn.
This also simplifies the upcoming extensive changes in this area
but more importantly, should make them easier to review by
grouping warnings in the same function.
4) Enhance information printed in debugging dumps.
gcc-78703-3.diff
commit d1a41d89a3b359e63937e87c619314ccd33562c5
Author: Martin Sebor <mse...@redhat.com>
Date: Fri Jan 20 17:26:56 2017 -0700
2017-01-20 Martin Sebor <mse...@redhat.com>
* gimple-ssa-sprintf.c (warn_level): New global.
(format_integer): Use it here and throughout the rest of the file.
Use the same switch to compute sign as base.
(maybe_warn): New function.
(format_directive): Factor out warnings into maybe_warn.
Add debugging output. Use warn_level.
(add_bytes): Use warn_level.
(pass_sprintf_length::compute_format_length): Add debugging output.
(try_substitute_return_value): Same.
(pass_sprintf_length::handle_gimple_call): Set and use warn_level.
OK. As with prior patches, go ahead and install now if it's been
bootstrapped and regression tested.
jeff