On 01/12/2017 02:26 PM, Jeff Law wrote:
On 01/12/2017 01:31 PM, Martin Sebor wrote:
With the move of the snprintf truncation checking from -Wformat-length
to the dedicated -Wformat-truncation option (done in r244210),
-Wformat-length isn't as descriptive as it could and should be for
an option whose sole focus is the detection of sprintf buffer overflow.
The name is also inconsistent with the name of -Wstringop-overflow
option which focuses on detecting buffer overflow by string operations
such as strcpy or memcpy.
To make the purpose of the option clearer and its name consistent with
-Wstringop-overflow the attached patch renames -Wformat-length to
-Wformat-overflow.
Thanks
Martin
gcc-wformat-overflow.diff
gcc/c-family/ChangeLog:
* c.opt (-Wformat-length): Rename...
(-Wformat-overflow): ...to this.
gcc/ChangeLog:
* doc/invoke.texi (Warning Options): Rename -Wformat-length
to -Wformat-overflow.
* gimple-ssa-sprintf.c (pass_sprintf_length::gate): Adjust.
(min_bytes_remaining): Same.
(get_string_length): Same.
(format_string): Same.
(format_directive): Same.
(add_bytes): Same.
(pass_sprintf_length::handle_gimple_call): Same.
gcc/testsuite/ChangeLog:
* gcc.c-torture/execute/pr78622.c: Adjust.
* gcc.dg/pr78138.c: Adjust.
* gcc.dg/pr78768.c: Adjust.
* gcc.dg/tree-ssa/builtin-sprintf-4.c: Adjust.
* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust.
* gcc.dg/tree-ssa/builtin-sprintf-warn-2.c: Adjust.
* gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: Adjust.
* gcc.dg/tree-ssa/builtin-sprintf-warn-4.c: Adjust.
* gcc.dg/tree-ssa/builtin-sprintf-warn-6.c: Adjust.
* gcc.dg/tree-ssa/builtin-sprintf-warn-7.c: Adjust.
* gcc.dg/tree-ssa/builtin-sprintf-warn-8.c: Adjust.
* gcc.dg/tree-ssa/builtin-sprintf-warn-9.c: Adjust.
* gcc.dg/tree-ssa/pr78605.c: Adjust.
* gcc.dg/tree-ssa/pr78622.c: Adjust.
OK with just a couple cleanups noted below.
Done in r244385.
Martin