https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108079

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:e4984838f6af868399ef9d885377199c38907ee1

commit r12-9287-ge4984838f6af868399ef9d885377199c38907ee1
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Fri Mar 10 10:10:24 2023 +0100

    c, c++, cgraphunit: Prevent duplicated -Wunused-value warnings [PR108079]

    On the following testcase, we warn with -Wunused-value twice, once
    in the FEs and later on cgraphunit again with slightly different
    wording.

    The following patch fixes that by registering a warning suppression in the
    FEs when we warn and not warning in cgraphunit anymore if that happened.

    2023-03-10  Jakub Jelinek  <ja...@redhat.com>

            PR c/108079
    gcc/
            * cgraphunit.cc (check_global_declaration): Don't warn for unused
            variables which have OPT_Wunused_variable warning suppressed.
    gcc/c/
            * c-decl.cc (pop_scope): Suppress OPT_Wunused_variable warning
            after diagnosing it.
    gcc/cp/
            * decl.cc (poplevel): Suppress OPT_Wunused_variable warning
            after diagnosing it.
    gcc/testsuite/
            * c-c++-common/Wunused-var-18.c: New test.

    (cherry picked from commit 2c63cc7268fd5615997989f153e9405d0f5aaa50)

Reply via email to