On 02/20/2017 01:35 PM, Jakub Jelinek wrote:
Hi!

As mentioned in the PR, -Wrestrict warning is done way too early, where
e.g. default arguments aren't filled up yet (reason for ICE on first
testcase) or where arguments in templates aren't instantiated yet (reason
why we don't diagnose anything on the second testcase).

This patch moves it later where e.g. -Wformat is diagnosed and fixes
some issues I found while looking at the code.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2017-02-20  Jakub Jelinek  <ja...@redhat.com>

        PR c++/79588
c-family/
        * c-common.c (check_function_arguments): Add FNDECL argument.
        Handle -Wrestrict here.
        * c-warn.c (warn_for_restrict): Remove ARGS argument, add ARGARRAY
        and NARGS.  Use auto_vec for ARG_POSITIONS, simplify.
        * c-common.h (check_function_arguments): Add FNDECL argument.
        (warn_for_restrict): Remove ARGS argument, add ARGARRAY and NARGS.
c/
        * c-parser.c (c_parser_postfix_expression_after_primary): Don't
        handle -Wrestrict here.
        * c-typeck.c (build_function_call_vec): Adjust
        check_function_arguments caller.
cp/
        * call.c (build_over_call): Call check_function_arguments even for
        -Wrestrict, adjust check_function_arguments caller.
        * parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict
        here.
        * typeck.c (cp_build_function_call_vec): Adjust
        check_function_arguments caller.
testsuite/
        * g++.dg/warn/Wrestrict-1.C: New test.
        * g++.dg/warn/Wrestrict-2.C: New test.
Please refactor the restrict warning bits into their own function, then calling that from check_function_arguments. That's the style already used there.

OK with that change.

jeff

Reply via email to