From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6967B3858281; Fri, 10 Mar 2023 09:15:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6967B3858281 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678439757; bh=3OgLnR7RyQxM9vFxBJEIh/cQ9q9FLaqcWRvAVNHr0NQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=s/XSzKQu4wwPDwzMNyI0hxzHUcwFMknUCfDEcuuZ38HrJR74G7xk/JTFKH+So8+z4 hwfSzJty7Y6AWpKETSxbLaJUR6qVLlngrqYJh8vunpWYxx1HTyxArhvPy1/lxzraN/ dOoQ5Jh2nkXebIldK4Laz4oPiJxmIjGUBb+IhOLc= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/108079] [10/11/12/13 Regression] -Wunused-variable gives misleading duplicate warning for unused static local variable Date: Fri, 10 Mar 2023 09:15:57 +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 #4 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:2c63cc7268fd5615997989f153e9405d0f5aaa50 commit r13-6575-g2c63cc7268fd5615997989f153e9405d0f5aaa50 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.=