Folding and check_function_arguments
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 29 Oct 2018 23:44:10 +0000 (23:44 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Mon, 29 Oct 2018 23:44:10 +0000 (23:44 +0000)
commitb2bf438c02e885ddcd89e3f372fe88d9c3a58fd9
tree0dcee2d28ee9534b49dcdd465bd13dd78d31a832
parentebdb73c0b0950509eab6a5fa7f0f5b360c6e5cca
Folding and check_function_arguments

This patch eliminates the arglocs array I introduced to build_over_call
in r264887, and eliminates the call to maybe_constant_value when building
"fargs" (thus retaining location wrapper nodes).

Instead, this patch requires that any checks within
check_function_arguments that need folded arguments do their own folding.

Of the various checks:
(a) check_function_nonnull already calls fold_for_warn,
(b) check_function_format doesn't need folding
(c) check_function_sentinel needs fold_for_warn in one place, which the
patch adds, and
(d) check_function_restrict needs per-argument folding, which the patch
adds.  Given that it scans before and after resetting TREE_VISITED on
each argument, it seemed best to make a copy of the array, folding each
argument from the outset, rather than repeatedly calling fold_for_warn;

gcc/c-family/ChangeLog:
PR c++/56856
* c-common.c (check_function_sentinel): Call fold_for_warn on the
argument.
(check_function_restrict): Rename param "argarray" to
"unfolded_argarray", and make a copy named "argarray", calling
fold_for_warn on each argument.
(check_function_arguments): Add note about responsibility for
folding the arguments.

gcc/cp/ChangeLog:
PR c++/56856
* call.c (build_over_call): Eliminate the "arglocs" array, and the
call to maybe_constant_value when building "fargs".

From-SVN: r265609
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/cp/ChangeLog
gcc/cp/call.c