From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CDFEB383E6A9; Sun, 19 Mar 2023 05:30:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CDFEB383E6A9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679203844; bh=oD71xp8Z8MJOtGuaUV8rTbDjodSLJPTBD1AFEp8Dhl4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=d/lHjUYha/zYgvz4tHyG3692pVQWIr8CZNoALO7DxLDPsqFczQCR1K6Mr1LAgYLf1 mzZGL0/8BoP+8pa//gnv+GAznwATWwr7Q2EHKq5h8U9QC8AMF6Y8B7a7NKisV0LZlT UBmi8abuaMxdeQN6EO7l3GJZIT9zbE7yIvQlsG0c= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/108079] [10/11/12 Regression] -Wunused-variable gives misleading duplicate warning for unused static local variable Date: Sun, 19 Mar 2023 05:30:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108079 --- Comment #6 from CVS Commits --- The releases/gcc-12 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:e4984838f6af868399ef9d885377199c38907ee1 commit r12-9287-ge4984838f6af868399ef9d885377199c38907ee1 Author: Jakub Jelinek Date: Fri Mar 10 10:10:24 2023 +0100 c, c++, cgraphunit: Prevent duplicated -Wunused-value warnings [PR10807= 9] 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 PR c/108079 gcc/ * cgraphunit.cc (check_global_declaration): Don't warn for unus= ed 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)=