aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-warn-alloca.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2021-07-06 13:41:02 -0600
committerMartin Sebor <msebor@redhat.com>2021-07-06 13:43:11 -0600
commit6d3bab5d5adb3e28ddb16c97b0831efdea23cf7d (patch)
treee01626f7d19dbd576102341cc414accad07f4fbb /gcc/gimple-ssa-warn-alloca.c
parent03b634c8e0d3e8628ced79fc4f40873e12a3039c (diff)
downloadgcc-6d3bab5d5adb3e28ddb16c97b0831efdea23cf7d.zip
gcc-6d3bab5d5adb3e28ddb16c97b0831efdea23cf7d.tar.gz
gcc-6d3bab5d5adb3e28ddb16c97b0831efdea23cf7d.tar.bz2
Improve warning suppression for inlined functions.
Resolves: PR middle-end/98871 - Cannot silence -Wmaybe-uninitialized at declaration site PR middle-end/98512 - #pragma GCC diagnostic ignored ineffective in conjunction with alias attribute gcc/ChangeLog: * builtins.c (warn_string_no_nul): Remove %G. (maybe_warn_for_bound): Same. (warn_for_access): Same. (check_access): Same. (check_strncat_sizes): Same. (expand_builtin_strncat): Same. (expand_builtin_strncmp): Same. (expand_builtin): Same. (expand_builtin_object_size): Same. (warn_dealloc_offset): Same. (maybe_emit_free_warning): Same. * calls.c (maybe_warn_alloc_args_overflow): Same. (maybe_warn_nonstring_arg): Same. (maybe_warn_rdwr_sizes): Same. * expr.c (expand_expr_real_1): Remove %K. * gimple-fold.c (gimple_fold_builtin_strncpy): Remove %G. (gimple_fold_builtin_strncat): Same. * gimple-ssa-sprintf.c (format_directive): Same. (handle_printf_call): Same. * gimple-ssa-warn-alloca.c (pass_walloca::execute): Same. * gimple-ssa-warn-restrict.c (maybe_diag_overlap): Same. (maybe_diag_access_bounds): Same. Call gimple_location. (check_bounds_or_overlap): Same. * trans-mem.c (ipa_tm_scan_irr_block): Remove %K. Simplify. * tree-ssa-ccp.c (pass_post_ipa_warn::execute): Remove %G. * tree-ssa-strlen.c (maybe_warn_overflow): Same. (maybe_diag_stxncpy_trunc): Same. (handle_builtin_stxncpy_strncat): Same. (maybe_warn_pointless_strcmp): Same. * tree-ssa-uninit.c (maybe_warn_operand): Same. gcc/testsuite/ChangeLog: * gcc.dg/Wobjsize-1.c: Prune expected output. * gcc.dg/Warray-bounds-71.c: New test. * gcc.dg/Warray-bounds-71.h: New test header. * gcc.dg/Warray-bounds-72.c: New test. * gcc.dg/Warray-bounds-73.c: New test. * gcc.dg/Warray-bounds-74.c: New test. * gcc.dg/Warray-bounds-75.c: New test. * gcc.dg/Wfree-nonheap-object-4.c: Adjust expected output. * gcc.dg/Wfree-nonheap-object-5.c: New test. * gcc.dg/Wfree-nonheap-object-6.c: New test. * gcc.dg/pragma-diag-10.c: New test. * gcc.dg/pragma-diag-9.c: New test. * gcc.dg/uninit-suppress_3.c: New test. * gcc.dg/pr79214.c: Xfail tests. * gcc.dg/tree-ssa/builtin-sprintf-warn-27.c: New test. * gcc.dg/format/c90-printf-1.c: Adjust expected output.
Diffstat (limited to 'gcc/gimple-ssa-warn-alloca.c')
-rw-r--r--gcc/gimple-ssa-warn-alloca.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/gcc/gimple-ssa-warn-alloca.c b/gcc/gimple-ssa-warn-alloca.c
index 72480f1..4fc7125 100644
--- a/gcc/gimple-ssa-warn-alloca.c
+++ b/gcc/gimple-ssa-warn-alloca.c
@@ -283,7 +283,7 @@ pass_walloca::execute (function *fun)
}
else if (warn_alloca)
{
- warning_at (loc, OPT_Walloca, "%Guse of %<alloca%>", stmt);
+ warning_at (loc, OPT_Walloca, "use of %<alloca%>");
continue;
}
else if (warn_alloca_limit < 0)
@@ -322,11 +322,10 @@ pass_walloca::execute (function *fun)
auto_diagnostic_group d;
if (warning_at (loc, wcode,
(is_vla
- ? G_("%Gargument to variable-length "
+ ? G_("argument to variable-length "
"array may be too large")
- : G_("%Gargument to %<alloca%> may be too "
- "large")),
- stmt)
+ : G_("argument to %<alloca%> may be too "
+ "large")))
&& t.limit != 0)
{
print_decu (t.limit, buff);
@@ -342,10 +341,9 @@ pass_walloca::execute (function *fun)
auto_diagnostic_group d;
if (warning_at (loc, wcode,
(is_vla
- ? G_("%Gargument to variable-length"
+ ? G_("argument to variable-length"
" array is too large")
- : G_("%Gargument to %<alloca%> is too large")),
- stmt)
+ : G_("argument to %<alloca%> is too large")))
&& t.limit != 0)
{
print_decu (t.limit, buff);
@@ -361,22 +359,20 @@ pass_walloca::execute (function *fun)
warning_at (loc, wcode,
(is_vla
- ? G_("%Gunbounded use of variable-length array")
- : G_("%Gunbounded use of %<alloca%>")),
- stmt);
+ ? G_("unbounded use of variable-length array")
+ : G_("unbounded use of %<alloca%>")));
break;
case ALLOCA_IN_LOOP:
gcc_assert (!is_vla);
warning_at (loc, wcode,
- "%Guse of %<alloca%> within a loop", stmt);
+ "use of %<alloca%> within a loop");
break;
case ALLOCA_ARG_IS_ZERO:
warning_at (loc, wcode,
(is_vla
- ? G_("%Gargument to variable-length array "
+ ? G_("argument to variable-length array "
"is zero")
- : G_("%Gargument to %<alloca%> is zero")),
- stmt);
+ : G_("argument to %<alloca%> is zero")));
break;
default:
gcc_unreachable ();