Skip to content
Snippets Groups Projects
Commit 2c63cc72 authored by Jakub Jelinek's avatar Jakub Jelinek
Browse files

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  <jakub@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.
parent a1d5c729
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment